我 tpl 文件里用了一个 smarty3.1 的{html_options optiOns=$AllLevel}为什么会报错啊, 错误代码:
Warning: require(C:\wamp64\www\php8/public/Smarty_Internal_Compile_Html_Options.class.php): failed to open stream: No such file or directory in C:\wamp64\www\php8\configs\run.inc.php on line 24
Fatal error: require(): Failed opening reqired 'C:\wamp64\www\php8/public/Smarty_Internal_Compile_Html_Options.class.php' (include_path='.;C:\php\pear') in C:\wamp64\www\php8\configs\run.inc.php on line 24
要改 php.ini 里的 include_path 吗要怎么改啊
![]() | 1 Carlgao 2020-05-25 22:52:41 +08:00 ![]() smarty? 好久没听到过这个了,已经是上古模板引擎了吧! |
![]() | 3 lifeintools 2020-05-26 09:23:31 +08:00 ![]() 写成绝对路径。同时看下该路径下的文件夹 以及文件的权限 |
![]() | 4 sy5587 OP @lifeintools 我换了个低版本的 smarty 没事了,高版本单独引入 Smart 类也没事,但是我是在 public 文件夹下用一个 TPL 类 return new Smarty(),然后用 spl_autoload_register()加载 TPL 的方式载入就出现这个错误了 |
![]() | 5 sy5587 OP 我换了个低版本的 smarty 没事了,高版本单独引入 Smart 类也没事,但是我是在 public 文件夹下用一个 TPL 类 return new Smarty(),然后用 spl_autoload_register()加载 TPL 的方式载入就出现这个错误了 |
![]() | 6 sy5587 OP 我现在只能先用着低版本的了,有明白的大佬指点下我,感激不尽 |
![]() | 7 xnode 2020-05-26 09:39:52 +08:00 ![]() php 高版本 有一些函数废弃了 造成 Smarty 不能用 建议用 php5.6 |
9 ChoateYao 2020-05-26 10:13:29 +08:00 ![]() 现在不用 smarty 了,而且前后端分离是大趋势,PHP 本身就是最好的模板引擎。 建议学个现代点的框架,先从 Yii2 开始吧,Laravel 太花里胡哨了对待新人不好。 |
![]() | 10 sy5587 OP @ChoateYao 谢谢你我先记下了,我看的是李炎恢的 PHP 第三季视频,好像是几年前的了,网上也没找到新的,我先把这个视频过一遍吧 |
11 ben1024 2020-05-26 10:37:12 +08:00 ![]() 新手的话,检测下目录是否有对应文件,如果没有文件手动放一个文件 |
![]() | 13 Canon1014 2020-05-26 12:23:41 +08:00 ![]() 楼上的不要争了作为外人看 react 和 vue 争都觉得心痛,Yii 和 Laravel 还有很多人看不上但是还是很多人用的 TP 都学的挺好的反正也快,具体主攻哪个不还是看公司要求 |
![]() | 14 acrazing 2020-05-26 17:04:23 +08:00 ![]() PHP 本身就是一个很完备的模板语言, 没必要用 smarty 这种花里胡哨的东西, smarty 自己搞了一堆语法, 你事实上在学习另一门语言. |
17 leoleoasd 2020-05-26 17:15:14 +08:00 ![]() 你说用 spl_autoload_register 加载, 看上去是没用 composer 等包管理器. 还是建议先学 laravel. 现在生产没人用 smarty 了. 并且 laravel 的 blade 的语法也比 smarty 的好很多. 引用文件的时候, 用基于 __DIR__ 的相对路径引用. __DIR__是代码所在文件夹. |
![]() | 18 sy5587 OP 高版本的 smarty 有问题,低版本的问题更多,折腾一下午,好像是我 run.inc.php 里的自动加载类和 smarty 有冲突 spl_autoload_register("_efc"); function _efc($_className) { if (substr($_className, -6) == 'Action') { require ROOT_PATH.'/controller/'.$_className.'.class.php'; } elseif (substr($_className, -5) == 'Model') { require ROOT_PATH.'/model/'.$_className.'.class.php'; } elseif (substr($_className, -5) == 'Check') { require ROOT_PATH.'/check/'.$_className.'.class.php'; } else { require ROOT_PATH.'/public/'.$_className.'.class.php'; } } 22 0.2376 3951688 class_exists ( ) ...\smarty_internal_templatecompilerbase.php:785 23 0.2377 3951992 spl_autoload_call ( ) ...\smarty_internal_templatecompilerbase.php:785 24 0.2385 3952048 _efc( ) ...\smarty_internal_templatecompilerbase.php:785 Fatal error: require(): Failed opening required 'C:\wamp64\www\php8/public/Smarty_Internal_Compile_Html_Options.class.php' (include_path='.;C:\php\pear') in C:\wamp64\www\php8\configs\run.inc.php on line 27 但是我不知道怎么改 |
19 leoleoasd 2020-05-26 17:15:51 +08:00 laravel 可以看这个文档 https://learnku.com/docs/laravel/7.x 同网站也有 laravel 的教程, 不过不知道质量如何. |
nbsp; 20 nocrush 2020-05-26 17:18:31 +08:00 ![]() 找个好点的视频吧,然后你这些代码看起来是上古时期的代码 |
![]() | 23 fiypig 2020-05-26 17:22:15 +08:00 ![]() 想快速上手就直接熟悉语法后, 就框架吧 ,我以前就是 tp 入门 |
![]() | 24 sy5587 OP 哎没有编程基础自学 PHP 好难啊 |
![]() | 25 putaozhenhaochi 2020-05-26 17:24:01 +08:00 via Android ![]() 这个 PHP8 文件夹让我一度以为。。。 |
![]() | 27 sy5587 OP 我先一个人静静,感谢大佬们的回复 |
![]() | 28 to2false 2020-05-26 17:37:11 +08:00 ![]() 既然自学,建议不要折腾 smarty 了,tp 的话也建议直接折腾高版本的, tp3 的也只是遇到存量项目需要维护的时候才去看看 框架你如果要看 tp,建议直接上 tp6,然后 php 语法、composer 、psr 规范等这些知识点先去了解下 |
29 k396656156 2020-05-26 17:45:54 +08:00 ![]() 好像想在都不用这个 smarty 吧,我当年学习的时候过了一遍菜鸟教程的 php 语法,直接 laravel 学起来了,开始觉得很复杂,搞习惯的还比较方便。后面其他的框架都差不多 |