還有 anyone know howto  define or echo  \ character in php script ?

http://php.net/manual/en/tokens.php

TOP

回復 11# fhleung
o下?有乜特別問題?
雙反斜線囉(\\)
老實講直接用addslashes就得...

不過關token咩事
T_NS_SEPARATOR        \        namespaces (available since PHP 5.3.0)

TOP

回復 12# tuyylihk

Because I got this programming error:
Parse error: syntax error, unexpected T_NS_SEPARATOR

TOP

Post ur code pls

TOP

shtml...

TOP

本帖最後由 fhleung 於 2013-1-24 16:37 編輯

"雙反斜線囉(\\)"
謝謝師兄, 因為我 hosting 係 Windows OS, 需要 read + write file, 需要 \ 而不是 /

"Post ur code pls"
  1. $opFile = "D:\\path\\image\\file.txt" ;
  2. $fp = @fopen($opFile,"a+") or die($lang_blog_error_reading . 'WHY DIE');
複製代碼
各位師兄, 知唔知點解不能  fopen  而去 die ?

TOP

D:\path\image\file.txt

TOP

"雙反斜線囉(\\)"
謝謝師兄, 因為我 hosting 係 Windows OS, 需要 read + write file, 需要 \ 而不是 /

"P ...
fhleung 發表於 2013-1-24 16:30


想講Window OS / 跟 \ 係無分別...有分別只會在開頭時用...
另外php想用\/ 建議用單引號...入面的東西會原汁原味....
$opFile = 'D:\path\image\file.txt' ;

TOP

這很複雜, 請一一討論

請試試
  1. $opFile = 'D:\\path\\file.txt' ;
  2. echo 'why die?' . $opFile ;
  3. $fp = fopen($opFile,"r+") or die('why die?') ;
複製代碼

TOP

http://www.php.net/manual/en/function.fopen.php

我用緊 Godaddy Windows hosting, 如果 fopen() 來講, 我只能夠
fopen($opFile,"r")  but NOT fopen($opFile,"r+")
fopen($opFile,"r")  but NOT fopen($opFile,"a")
fopen($opFile,"r")  but NOT fopen($opFile,"a+")


error = failed to open stream: Permission denied

TOP