您可以自定义最大执行时间错误消息吗
can you customise the maximum execution time error message
是否可以自定义最大执行时间而不是显示
PHP Fatal Error – yii\base\ErrorException
超过 30 秒的最大执行时间
然后在错误页面上显示所有代码,我希望它将您带到一个自定义的错误页面,上面写着类似“您需要添加一些搜索条件以减少返回的记录数”之类的内容。 =14=]
或类似的东西。我正在使用 Yii2 和 PHP
我的站点控制器中有以下操作
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
我有一个名为 views/site/error 的页面。php
<div class="alert alert-danger" style="font-size: 14pt; text-align: center;">
<?= nl2br(Html::encode($message)) ?>
</div>
<p>
Please contact Client Support team if you think this is an error with our servers.
</p>
<?= Html::a('Back', Yii::$app->request->referrer, ['class' => 'btn btn-info']) ?>
<?= Html::a('Home', ['/'], ['class' => 'btn btn-success']) ?>
但如果永远不会进入此页面并出现执行时间错误
不确定我做了什么,但它现在确实进入了自定义错误页面,但它仍然显示我的自定义消息下方的代码
有没有办法去掉我的自定义消息下方的信息。除了上面的代码
之外,我的 error.php 上没有其他内容
经过进一步调查,我发现它会转到另一个页面 execption.php 而不是 error.php,后者在文本下方显示了完整的错误。所以我现在设法对它进行排序:)
是否可以自定义最大执行时间而不是显示
PHP Fatal Error – yii\base\ErrorException
超过 30 秒的最大执行时间
然后在错误页面上显示所有代码,我希望它将您带到一个自定义的错误页面,上面写着类似“您需要添加一些搜索条件以减少返回的记录数”之类的内容。 =14=]
或类似的东西。我正在使用 Yii2 和 PHP
我的站点控制器中有以下操作
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
我有一个名为 views/site/error 的页面。php
<div class="alert alert-danger" style="font-size: 14pt; text-align: center;">
<?= nl2br(Html::encode($message)) ?>
</div>
<p>
Please contact Client Support team if you think this is an error with our servers.
</p>
<?= Html::a('Back', Yii::$app->request->referrer, ['class' => 'btn btn-info']) ?>
<?= Html::a('Home', ['/'], ['class' => 'btn btn-success']) ?>
但如果永远不会进入此页面并出现执行时间错误
不确定我做了什么,但它现在确实进入了自定义错误页面,但它仍然显示我的自定义消息下方的代码
有没有办法去掉我的自定义消息下方的信息。除了上面的代码
之外,我的 error.php 上没有其他内容经过进一步调查,我发现它会转到另一个页面 execption.php 而不是 error.php,后者在文本下方显示了完整的错误。所以我现在设法对它进行排序:)