Ugga Posted February 13, 2006 Report Posted February 13, 2006 Kāda fukcionāli atšķirās Include no Require? php.net rakstīts ka pēc kļūdas require pārtrauc lapas ielādi, bet include nē. tā ir vienīgā atšķirībā? kā ar pieredzi?
hmnc Posted February 13, 2006 Report Posted February 13, 2006 nu tā arī ir vienīgā atšķirība :) ko tad vēl tev vajag?
Ugga Posted February 13, 2006 Author Report Posted February 13, 2006 Nu es te 1999 gada ebūku lasu un tur ir sekojošs teksts: .....The include statement also accesses an external file of code, but it evaluates and executes the code in the external file each time that the include statement is encountered, rather than just replacing itself with the external code once at the beginning of execution. Suppose we have three files, named file1.php, file2.php and file3.php, which contain code we want to include in another PHP pahe. With include, we can do this: for ($i = 1; $i <= 3; ++$i) { include("file" . $i . ".php"); } If we tried this with require, the contents of file1.php would replace the require statement on the first iteration of the loop, and that code would thus be re-executed on the subsequent iterations......... Bet tur bija arī piebilde, ka kopš PHP4 tas tā vairs nav. Vnk interesanti. ;)
bubu Posted February 13, 2006 Report Posted February 13, 2006 Vai tad tiešām tik grūti izlasīt: http://lv2.php.net/require require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error
Grey_Wolf Posted February 14, 2006 Report Posted February 14, 2006 include taapat kaa f-ja var atgriest veertiibu
Recommended Posts