直接上点小代码
debugging = true;$smarty->display('index.tpl');?>
代码如上,很简单,两段代码的文件结构在同一个目录下
就这样,运行死活说找不到类..........
fatal error: class 'smarty\smarty_test' not found in ............
实在是没搞明白,我在thinkphp框架里也是使用命名空间完全没问题,怎么新建一个项目放连个文件,测试一下它死活都不行呢....连zend studio编辑器都能显示出有存在smarty_test这个类,怎么运行的时候就是不行,,郁闷啊
回复讨论(解决方案) 没人吗..............
很不错lll
你没有加载含有 smarty_test 类定义的文件
你没有加载含有 smarty_test 类定义的文件
如何加载?使用include包含进去是吗?
是的,include包含进来
或者设置自动加载
spl_autoload_register();use smarty\smarty_test; $smarty = new smarty_test();$smarty->assign('name','ned');$smarty->debugging = true;$smarty->display('index.tpl');