Notice (8): file_put_contents(): Write of 270 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 822 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 3152 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 124 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2792 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write 'e0b5ff9e680db333e91d4494ebd565e3' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2587 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 142 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2792 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write 'a100c6cb28672da97df114d0512f839e' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2587 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 94197 of 94197 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2491 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 90093 of 90101 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2491 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Smarty入门之获取配置信息 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >> PHP

Smarty入门之获取配置信息

PHP 2014-11-29 07:42:16 转载来源: 网络整理/侵权必删

本文一篇smarty的入门教材,为大家讲解的是获取配置信息的方法,感兴趣的同学参考下。 Smarty模板的特性决定了它的优越性,更是PHPer追捧的原因之所在(更多的是招聘的大部分都要求),今天大致看了Smarty的基本使用方法,不过光看也没用,中午没事随便试了试,结果就一个小问题却导致我中午没了睡觉的时间了 先看结果—— 页面源代码如下:   分析一下代码,经过检查index_config.php(Smarty连接文件)、index.php文件均无错,下面重点看看模板文件,可能原因就出在这个tpl文件上,出代码—— {% config_load file="1.conf" section="style2" %} <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8&qu

本文一篇smarty的入门教材,为大家讲解的是获取配置信息的方法,感兴趣的同学参考下。

Smarty模板的特性决定了它的优越性,更是PHPer追捧的原因之所在(更多的是招聘的大部分都要求),今天大致看了Smarty的基本使用方法,不过光看也没用,中午没事随便试了试,结果就一个小问题却导致我中午没了睡觉的时间了
先看结果——

页面源代码如下:

 

分析一下代码,经过检查index_config.php(Smarty连接文件)、index.php文件均无错,下面重点看看模板文件,可能原因就出在这个tpl文件上,出代码——


{% config_load file="1.conf" section="style2" %}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>{% #title# %}</title>
</head>
<body bgcolor="{% #bgcolor# %}">{%$hello%}
{%*这是一个注释语句*%}
<br />
{%$array.0.0%}
</body>
</html>


Smarty不能将模板文件中的变量解析成相应的值,肯定是调用文件时的错误了,但看着写的代码也没错啊,和书上的、网上的几乎一模一样的,怎么会出错呢??

百思不得其解之际,突然发现,在调用变量时自己的代码比他们多了空格…………………………

删除空格,大功告成:

页面源代码

总结,在使用Smarty模板时,不要为了代码的美观和可读性而增加空格,这样Smarty不会把这些当成变量解析的,而会直接输出


标签: Smarty 入门 获取 配置 信息


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2025 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持