PEAK XOOPS - Constant __FILE__ is not available in pico contents in englishin japanese

Constant __FILE__ is not available in pico contents

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2007/3/23 5:30
hoshiyan  二等兵   Posts: 8
Hi,GIJOE!

I have a problem about __FILE__ php constant. In pico contents,
the code defined(__FILE__) becomes FALSE.

$r1 = (defined(__FILE__))? "defined":"not defined";
echo $r1;

In my environment, the result of above code is "not defined".

PHP/5.2.0-8, Apache2

Hoshiyan
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2007/3/23 5:57 | Last modified
GIJOE  先任軍曹   Posts: 4110
You should learn PHP more.

__FILE__ is a special constant.

defined('__FILE__') always returns false, certainly.

But you can use __FILE__ or __LINE__ in any places of PHP.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2007/3/23 7:33
hoshiyan  二等兵   Posts: 8
Thanks GIJOE.

Sure! I must learn php more and more.

Last time I tested my contents, I have a error about __FILE__ constant. However, now, I test the same code agin, it works fine. Hmmm....

Anyway, I must learn about php hard. Thank you again!

Hoshiyan
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2007/3/23 8:00
hoshiyan  二等兵   Posts: 8
補足です。

picoのPHPのコンテンツはeval()にわたされてそこで評価されているので、『コンテンツのPHPコードそのもの』に関連する問題(エラーや警告等)はまずほとんどpico側に問題があるのでは『ない』という視点で徹底的に自分のコードを見直すべきだということです。

私がレポートした__FILE__の件も、そのときはどうしても動かなかったのですが、いろいろ他をいじっているうちに動くようになっていたという次第。GIJEOさんに指摘されて再テストしたら、なんと!正常に動いていたという状況でした。

お騒がせして申し訳ありません!

Hoshiyan
Votes:8 Average:5.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!