php smarty 访问显示空白,什么内容都没有?
迷茫
迷茫 2017-04-10 15:05:16
[PHP讨论组]

访问127.0.0.1/smarty/test/test.php 一片空白 什么也没有
chrome 控制台报 server 500
但在chrome的隐身版本里没有这个错误
不知道什么原因,小白求助。。
test.php代码如下

<?php  
    require("lib/Smarty.class.php"); //引入smarty 

    $smarty = new Smarty();  

    $smarty->left_delimiter ="{";//左定界符 

    $smarty->right_delimiter="}"; 

    $smarty->template_dir ="tpl";//视图模板存放地址 

    $smarty->compile_dir="template_c"; //模板编译后的存放目录 

    $smarty->cache_dir = "cache"; //缓存 

    $smarty->caching = true;  

    $smarty->cache_lifetime = 120; //缓存时间 

    $smarty->assign("title","标题"); //变量,value 

    $smarty->assign("content","内容"); 

    $smarty->display("test.html");  //模板名称 
 ?> 

放在tpl文件夹的 test.html

<html> 
    <head> 
        <title> {$title} </title> 
    </head>
    <body> 
        {$content} 
    </body> 
</html> 

使用的是ubuntut14.04。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回复(2)
伊谢尔伦
ini_set("display_errors","On"); error_reporting(E_ALL &~ E_NOTICE)
高洛峰

PHP配置文件默认设置不显示报错,可以直接设置php.ini文件

将display_errors = Off修改成

display_errors = On
即可。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号