daGrevis Posted July 22, 2011 Report Share Posted July 22, 2011 Tas nebija domāts konkrētu par kādu lapu, bet vairāk vispārīgi... Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 22, 2011 Report Share Posted July 22, 2011 (edited) @Grey_Wolf tas tā ir kaut kādā tāvā sevišķajā php versijā vai varbūt php3 tā bija? :) Vispār palasam manuāli: http://php.net/require Vispār palasam manuali ;) --- Handling Returns: It is possible to execute a return() statement inside an included file in order to terminate processing in that file and return to the script which called it. Also, it's possible to return values from included files. You can take the value of the include call as you would a normal function. This is not, however, possible when including remote files unless the output of the remote file has valid PHP start and end tags (as with any local file). You can declare the needed variables within those tags and they will be introduced at whichever point the file was included. Because include() is a special language construct, parentheses are not needed around its argument. Take care when comparing return value. -- Example #4 Comparing return value of include <?php // won't work, evaluated as include(('vars.php') == 'OK'), i.e. include('') if (include('vars.php') == 'OK') { echo 'OK'; } // works if ((include 'vars.php') == 'OK') { echo 'OK'; } ?> Example #5 include() and the return() statement return.php <?php $var = 'PHP'; return $var; ?> noreturn.php <?php $var = 'PHP'; ?> testreturns.php <?php $foo = include 'return.php'; echo $foo; // prints 'PHP' $bar = include 'noreturn.php'; echo $bar; // prints 1 ?> -- ši ficha jau ir no, kaa minimums, no PHP4 versijas (par 3 nezinu) Edited July 22, 2011 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 22, 2011 Report Share Posted July 22, 2011 Nu jā... tur rakstīts, ka 'include()' var darīt tā - kā parādīji, bet tas nav iespējams, ja fails atrodas ne-uz-Tava servera. Nekas par 'require()' netika minēts! Tikai manuāli par 'include()'... The documentation below also applies to require(). Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 22, 2011 Report Share Posted July 22, 2011 Nu jā... tur rakstīts, ka 'include()' var darīt tā - kā parādīji, bet tas nav iespējams, ja fails atrodas ne-uz-Tava servera. Nekas par 'require()' netika minēts! Tikai manuāli par 'include()'... njaa.. tiko patesteeju ka 5 tas pats ir ar require(), 4 tas nestradaaja .. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 22, 2011 Report Share Posted July 22, 2011 njaa.. tiko patesteeju ka 5 tas pats ir ar require(), 4 tas nestradaaja .. Es tak saku! Par PHP 4 nemācēšu spriest... PHP 4 laikos vēl nezināju, kas vispār ir PHP. :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.