Neden denemiyorsunuz?
: Örneğin, temp.php
, bu içeren adında ilk dosya olabilir
<?php
$a = my_func();
include 'temp-2.php';
function my_func() {
die;
}
Ve ikinci dosya, temp-2.php
, bu içerecektir:
<?php
sleep(5);
Eğer temp.php
web tarayıcıdan çağırdığınızda sayfa yüklemek için, ne kadar sürer? Bu neredeyse anlık? Ya da 5 saniye sürer?
temp-2.php
eklenmeden önce ilk durumda, fonksiyon denir.
... Ve, denedikten sonra: o sadece bir an sürer - işlevinde bir kalıp veya çıkış olduğunda ikinci dosyayı dahil değildir anlamına gelir.
EDIT after the comment : oh, üzgünüm, ben gerçekten soruyu anlamadı, herhalde :-(
temp.php
hala bu içerir: İşte başka bir deneyin:
<?php
$a = my_func();
include 'temp-2.php';
function my_func() {
die;
}
Ama temp-2.php
dosya şimdi sadece o içerir:
<?php
,
Hangi PHP bu dosyayı ayrıştırmak için çalışırsa, evet, sana bir ayrıştırma hatası alırsınız.
If you call temp.php
from your problem, it doesn't seem to be any problem at all : nothing is displayed, and there is no parse error.
Eğer my_func
işlevi içinde "die
" satır yorum ve tarayıcınızda tekrar temp.php
arama deneyin Şimdi, eğer, olsun:
Parse error: syntax error, unexpected ',' in /home/squale/developpement/tests/temp/temp-2.php on line 3
Hangi PHP bu ikinci dosyayı ayrıştırmak için çalışırsa bir ayrıştırma hatası var demektir.
So, the first time, the function has been called before PHP actually tried to parse the second file.
Daha iyi soru bu cevap, bu kez umut :-)