我在index.php中有这个
include 'app/Core.php';
echo Core::getPageHtml();
Run Code Online (Sandbox Code Playgroud)
在Core.php中
final class Core
{
public static function getPageHtml()
{
ob_start();
include 'layout.php';
$html = ob_get_clean();
return $html;
}
}
Run Code Online (Sandbox Code Playgroud)
layout.php是正常的html代码,我可以看到de page,只是完美,但javascript代码不起作用,我甚至写了一个警告('hello world'),就像这样
<script type="text/javscript">
alert('hello world');
</script>
Run Code Online (Sandbox Code Playgroud)
所以,它应该很简单,但我可以使它工作,我在这里缺少什么?需要一些帮助这个代码