AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein [PHP]String an Anfang einer Textdatei
Thema durchsuchen
Ansicht
Themen-Optionen

[PHP]String an Anfang einer Textdatei

Ein Thema von Angel4585 · begonnen am 28. Nov 2006 · letzter Beitrag vom 29. Nov 2006
 
Benutzerbild von H4ndy
H4ndy

Registriert seit: 28. Jun 2003
Ort: Chemnitz
515 Beiträge
 
Delphi XE3 Professional
 
#7

Re: [PHP]String an Anfang einer Textdatei

  Alt 28. Nov 2006, 15:40
Und prüfe am besten mal, ob dir fseek auch 0 (Erfolg) und nicht -1 (Fehlgeschlagen) zurückliefert.
Siehe auch http://de2.php.net/manual/de/function.fseek.php

Falls du kein PHP5 hast:
Code:
  if (!function_exists("file_put_contents")) {
    /**
     * For PHP4 backward compatibiliy.
     * Provides a simple version of the PHP5 function file_put_contents.
     * Provious content in the file $filename will be lost.
     * Returns the bytes which were successfully written.
     *
     * @param string $filename
     * @param string $text
     * @return integer
     */
    function file_put_contents($filename,$text){
      // provides file_put_contents for PHP < PHP5
      $fp = fopen($filename,"w+");
      $result = fwrite($fp,$text);
      fclose($fp);
      return $result;
    }
  }

  if (!function_exists("file_get_contents")) {
    /**
     * For PHP4 backward compatibiliy.
     * Provides a simple version of the PHP5 function file_get_contents.
     * Returns the content of the file as a string.
     *
     * @param string $filename
     * @return string
     */
    function file_get_contents($filename){
      if(($contents = file($filename))){
        $contents = implode('', $contents);
        return $contents;
      } else {
        return false;
      }
    }
  }
Manuel
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz