我的 smarty 模板未显示

Sug*_*san 0 php smarty

我在 Linux 上使用 Php Smarty。

我的 PHP 文件中有一行:

$phpsmart->display("pagetemplate.tpl");
Run Code Online (Sandbox Code Playgroud)

该行应该显示pagetemplate.tpl. 事实并非如此。

Pro*_*ock 6

启用错误,或检查您的日志。最有可能的是你没有设置smarty需要的可写目录。

我刚刚安装了 smarty 和作曲家:

$ composer.phar require smarty/smarty
Run Code Online (Sandbox Code Playgroud)

并尝试了演示:

( ! ) Fatal error: Uncaught --> Smarty: unable to write file ./templates_c/wrt56681191371d80_85949214 <-- thrown in /var/www/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_write_file.php on line 46
Run Code Online (Sandbox Code Playgroud)

然后我创建了“template_c”文件夹,并使其可由网络服务器写入。

( ! ) Fatal error: Uncaught --> Smarty: unable to write file ./cache/wrt566812bd6f7b08_17223124 <-- thrown in /var/www/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_write_file.php on line 46
Run Code Online (Sandbox Code Playgroud)

然后我创建了“缓存”文件夹,并使其可由网络服务器写入。

然后演示就成功了。

请参阅快速安装