gpt4 book ai didi

php - php 网站上某些查询白屏死机?

转载 作者:行者123 更新时间:2023-11-30 00:50:37 25 4
gpt4 key购买 nike

您好,我在我的 php 网站上遇到白屏死机,这种情况仅在给定特定查询时发生,而且我似乎找不到任何错误。我尝试查看 var/logs/apache2 并查找 php 错误日志,但没有。

我正在使用 yii。我有一个列出过滤内容的页面。在我的 Controller 中,我有一个查询:

     $model= Person::model()->findbyPk('12345');
$list = $model->contacts;

“联系人”是“人”模型的关系,列表是我应该显示的内容。如果我用键“12345”、“14256”和“23489”查询人员,页面将正确显示。但是当我查询特定的“10012”时,它会给我一个白屏,没有错误,也没有样式格式。只是一个空白屏幕。而且它的加载时间也比其他查询要长。我尝试记录它并 checkin 共享数据/运行时,但它甚至无法到达 Controller 。这只会发生在这个特定的人身上。

最可能的原因是什么?

最佳答案

您需要检查您的 $model 是否得到结果。试试这个

$model= Person::model()->findbyPk('12345');
if($model=== NULL)
{
throw new CHttpException('I am empty. Please try another key');
}
else
{
// whatever you wanna do
}

关于php - php 网站上某些查询白屏死机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21009887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com