php mvc require了index.html,但是里面的js img 路径都不对了,如何实现正确的输出?


自己写了个php最简单的mvc,模板里html文件的js img文件无法正常输出,
经判断是路径问题。
我是
protected function render($tpl,$data){
extract($data);
ob_start();
require("./view/".$tpl."View.php");
$content = ob_get_contents();
ob_end_flush();

}
这样实现的模板输出, require了index.html,但是里面的js img 路径都不对了,如何实现正确的输出?

php

十文字乱樱 8 years, 11 months ago

smarty模板的路径是根据加载文件的路径走的,而不是相对模板文件的路径,希望可以提醒到你

我de永恒 answered 8 years, 11 months ago

Your Answer