two classes, one page, 2nd class dies before instantiation
How can I code a page to call two classes that go to the same db, then parse the results separately? If I try
require_once('class1.php');
$api = new api(array(
'query' => 'foo',
));
$results = $api->fetch();
foreach
these results are parsed, but if I then try lat开发者_如何学编程er on the same page
require_once('class2.php');
$api = new api(array(
'query' => 'bar',
));
$results = $api->fetch();
foreach
it will die before instantiation.
This behavior happens when there's a syntax error inside your class. It can be in your function, in your constructor, or in a definition. For whatever reason, some versions of PHP don't catch this, so instead of alerting the user of the syntax error, PHP just stops running.
精彩评论