English 中文(简体)
当模板未能汇编时,如何使粗略产出脱硫?
原标题:How to make smarty output debug info when template fails to compile?
  • 时间:2010-11-03 07:24:12
  •  标签:
  • php
  • smarty

I m已经设定了debugging Options to true ,但是,如果在打字模板上出现错误(即没有相应的缩略语),则无数据可供参考。

<>>>>>

对于想要尝试的人来说,这是我可以认为的最简单的模板:

{$var|nosuch_modifier} 
问题回答

第一,如果出现错误——报告,你可以检查。 通常在php.ini这样做,但你可以把这些发言放在你的实验室来源之上。

ini_set( display_errors , 1);
ini_set( error_reporting , E_ALL);

并确保不在其他地方残疾。

2- 婚姻可报告错失为例外。 你们可以确定一个全球例外的手,以追捕他们。

try {
    // place your code here
} catch (Exception $e) {
    echo  Caught exception:  ,  $e->getMessage(), "
";
}

最新评论:

我认为,唯一的原因就是你打上了<条码>,不实。

$tpl->compile_check = false;

在这种情况下,Sarty将显示最新汇编的来源,无论你对卷宗有何作用。 因此,你是否真的检查和设定了<代码>兼容_check?

$tpl->compile_check = true;

<>Try

ini_set( display_errors , true);
error_reporting(E_ALL);

载于PHP代码。

可人工确定聪明错误报告。

$smarty->error_reporting = E_ALL ^ E_NOTICE;

一些来自Sarty.ster.php的评论

error muting is done because some people implemented custom error_handlers using http://php.net/set_error_handler and for some reason did not understand the following paragraph:

It is important to remember that the standard PHP error handler is completely bypassed for the error types specified by error_types unless the callback function returns FALSE. error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately. Of particular note is that this value will be 0 if the statement that caused the error was prepended by the @ error-control operator.

Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include - @filemtime() is almost twice as fast as using an additional file_exists() - between file_exists() and filemtime() a possible race condition is opened, which does not exist using the simple @filemtime() approach.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签