PHP - 回声和死亡

时间:2015-10-25 14:50:12

标签: php exit die

我意识到or die("message")会打印邮件并退出,但如何回复邮件并退出?

$resolveGet = mysql_query($sqlGet) or exit("<span style='padding-left:10px;'>No results matching search term provided.</span>");

1 个答案:

答案 0 :(得分:1)

您的特定代码也可以采用不同的方式编写,因为您拥有的代码是逻辑

$resolveGet = mysql_query($sqlGet);
if (!$resolveGet ) {
    // exit("<span style='padding-left:10px;'>No results matching search term provided.</span>");

    // can rewrite this as 
    echo "<span style='padding-left:10px;'>No results matching search term provided.</span>";
   die(); // or exit;  // whatever
}