ubuntu下Smarty3配置后页面空白解决方法
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ubuntu下Smarty3配置后页面空白解决方法,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3723字,纯文字阅读大概需要6分钟。
内容图文
ubuntu下Smarty3 配置后 页面空白今天学习了php 的smarty模板,在机器搭建的时候 ,按照教程下载了Smarty-3.1.21.tar.gz 解压后将lib文件放至/var/www/html/SM 并改变文件夹名为smarty 并在/var/www/html/SM 目录下创建templates templates_c两个文件夹 并修改权限至 drwxrwxrwx
在/var/www/html/SM 目录下新建php文件 index.php
require './smarty/Smarty.class.php' ;
$smarty=new Smarty();
$smarty->setTemplateDir('./templates');
$smarty->setCompileDir('./templates_c');
//print_r($smarty->setCompileDir());
$smarty->assign('title',"dfdf");
$smarty->assign('author',"dfdf");
$smarty->assign('poem1',"dfdf");
$smarty->assign('poem2',"dfdf");
$smarty->assign('poem3',"dfdf");
$smarty->assign('poem4',"dfdf");
$smarty->display('Example1801.html');
?>
在/var/www/html/SM/templates 目录下新建html文件 Example1801.html
第一个 Smarty程序
{$title} | |
{$author} | |
{$poem1} | {$poem2} |
{$poem3} | {$poem4} |
浏览器上输入http://localhost/SM/index.php后显示空白页
运行print_r($smarty->setCompileDir());
显示
Smarty Object ( [auto_literal] => 1 [error_unassigned] => [use_include_path] => [template_dir:Smarty:private] => Array ( [0] => ./templates/ ) [joined_template_dir] => ./templates/ [joined_config_dir] => ./configs/ [default_template_handler_func] => [default_config_handler_func] => [default_plugin_handler_func] => [compile_dir:Smarty:private] => / [plugins_dir:Smarty:private] => Array ( [0] => /var/www/html/SM/smarty/plugins/ ) [cache_dir:Smarty:private] => ./cache/ [config_dir:Smarty:private] => Array ( [0] => ./configs/ ) [force_compile] => [compile_check] => 1 [use_sub_dirs] => [allow_ambiguous_resources] => [caching] => [merge_compiled_includes] => [inheritance_merge_compiled_includes] => 1 [cache_lifetime] => 3600 [force_cache] => [cache_id] => [compile_id] => [left_delimiter] => { [right_delimiter] => } [security_class] => Smarty_Security [security_policy] => [php_handling] => 0 [allow_php_templates] => [direct_access_security] => 1 [debugging] => [debugging_ctrl] => NONE [smarty_debug_id] => SMARTY_DEBUG [debug_tpl] => file:/var/www/html/SM/smarty/debug.tpl [error_reporting] => [get_used_tags] => [config_overwrite] => 1 [config_booleanize] => 1 [config_read_hidden] => [compile_locking] => 1 [cache_locking] => [locking_timeout] => 10 [template_functions] => Array ( ) [default_resource_type] => file [caching_type] => file [properties] => Array ( ) [default_config_type] => file [template_objects] => Array ( ) [cache_modified_check] => [registered_plugins] => Array ( ) [plugin_search_order] => Array ( [0] => function [1] => block [2] => compiler [3] => class ) [registered_objects] => Array ( ) [registered_classes] => Array ( ) [registered_filters] => Array ( ) [registered_resources] => Array ( ) [_resource_handlers] => Array ( ) [registered_cache_resources] => Array ( ) [_cacheresource_handlers] => Array ( ) [autoload_filters] => Array ( ) [default_modifiers] => Array ( ) [escape_html] => [start_time] => 1423049920.1225 [_file_perms] => 420 [_dir_perms] => 505 [_tag_stack] => Array ( ) [smarty] => Smarty Object *RECURSION* [_current_file] => [_parserdebug] => [merged_templates_func] => Array ( ) [template_class] => Smarty_Internal_Template [tpl_vars] => Array ( ) [parent] => [config_vars] => Array ( ) )
网上很多网友说是权限的问题,导致不能对templates_c进行写,我已经用chmod 777 更改权限,但是问题还是不能解决,希望有大神出来解答一下,刚刚使用ubuntu和接触php 还有很多不懂的东西,希望能得到解答。
------解决思路----------------------
打开错误提示呢?有错误么?
------解决思路----------------------
我指的是程序中ini_set("display_errors",1); error_reporting(E_ALL);的情况下,有没有报错。
这种smarty的空白页面,多半是目录的权限问题。不只是template_c,template, 父目录最起码也应该有x的权限,否则是无法写入的。
内容总结
以上是互联网集市为您收集整理的ubuntu下Smarty3配置后页面空白解决方法全部内容,希望文章能够帮你解决ubuntu下Smarty3配置后页面空白解决方法所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。