スクリプト全体をクラッシュせずにPHP関数のエラーを処理したいと考えています。クラッシュのないPHP関数でのエラー処理
まずそれがこのエラーをプッシュ:
Notice: Trying to get property of non-object in E:\amir\1magazine\tools\xampp\htdocs\CairoHash\assests\plugins\content_handling.php on line 74
私はエラーが何のためにあるのかを知っているが、私は私のスクリプトをクラッシュすることなく続けていきたいです。
私はif
を試しましたが、期待通りに機能しませんでした。
$count = count($selector);
$order = substr($order, 0 , -1);
switch ($count)
{
case 1:
$i = $html->find($selector);
break;
case 2:
$i = $html->find($selector[0],$selector[1]);
break;
case 3:
/* ln 74 ->>> */ $i = $html->find($selector[0],$selector[1])->$selector[2];
break;
}
if(isset($i))
{
return $i;
}
このコードは$i
変数を取得することになったが、私はそれが機能しなかったならば、クラッシュしていないと言う必要があります。
ありがとうございました:) –