Web lists-archives.com

Re: [PHP] Include a B.php but not influence A.php





On May 18, 2016, at 10:46 PM, Jigar Dhulla wrote:

On Thu, May 19, 2016 at 6:56 AM, 酷丁 <zsxx51@xxxxxxxxxx> wrote:

hi,everyone!


a problem has troubled me for a long time,I have searched ,but haven't
found the answer.
some thing like this:


---A.php
<?php
include 'b.php';
echo 'test A.php';//because calling exit in b.php,so this can't be execute
?>


---B.php
<?php
exit("test B.php");
?>

can you comment out portions of script for testing?
Try and find the code in B.php that actually calls exit
and comment it out.

If you don't need to include B.php at the top, put it after
echo 'test A.php'; //If code in A.php doesn't depend on B.php

Other wise it looks like you have situation that won't work regardless
of what you do with it.

JK



I want to include b.php(b.php is a third library,but it will exit the
script) but no die.I try to find some function that can execute b.php and
not die a.php ,but I can't.
are there any other method can do this?


thk...


​Hi,

Libraries generally never die, they only have classes to include in
project. According to me, it must be a full-fledged application/ script, so what I can suggest is that you run the script externally. Means, if your
app is located at http://<your-domain>.com then that script can be
http://<script>.<your-domain>.com
or http://<your-domain>.com/<script>.

After setting up like this you can make curl or ajax request to 3rd party
script URL to fetch the output.

I personally do it that way. Hope this helps.​


--
Regards,
Jigar Dhulla


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php