Hier ist meine PHP-Code:Warum funktioniert file_exists() nicht?
[[email protected] htdocs]# vi test.php
<?php
var_dump(file_exists('/usr/local/apache2/resumes/28/"Chapel Hill"/franky_li/"CV.doc"'));
?>
"test.php" [New] 5L, 100C written
[[email protected] htdocs]# php test.php
bool(false)
die sagt die Datei nicht existiert, aber in Wirklichkeit tut es:
[[email protected] htdocs]# ls -l /usr/local/apache2/resumes/28/"Chapel Hill"/franky_li/"CV.doc"
-rw-r--r-- 1 daemon root 36864 Oct 17 2008 /usr/local/apache2/resumes/28/Chapel Hill/franky_li/CV.doc
[[email protected] htdocs]#
scheint es in der Tat Zitat Ausgabe:
<?php
var_dump(file_exists('/usr/local/apache2/resumes/28/Chapel Hill/franky_li/CV.doc'));
?>
~
~
"test.php" 5L, 96C written
[[email protected] htdocs]# php test.php
bool(true)
[[email protected] htdocs]#
jetzt mit folgendem Konverter behoben:
preg_replace('/\/([^\/\s]+\s+[^\/]+)(?:\/|$)/','/"${1}"/',$file);
, damit es in bash funktioniert!
möglich duplikate von [PHP file_exists() wird nicht funktionieren für mich?] (Http://stackoverflow.com/questions/1287837/phps-file-exists-will-not-work-for-me) – razlebe