yii RegisterScript文件不工作

yii RegisterScript文件不工作,yii,Yii,我在themes/bootstrap/views/layouts/main.php的顶部添加了这段代码 在我的html中,它确实显示 <head> <script type="text/javascript" src="/dev2/js/custom.js"></script> </head> 当页面加载时,不会显示任何警报。这些文件确实存在于正确的目录中,我没有收到firebug警告。由于某种原因,我使用registerScriptFi

我在themes/bootstrap/views/layouts/main.php的顶部添加了这段代码

在我的html中,它确实显示

<head>
    <script type="text/javascript" src="/dev2/js/custom.js"></script>
</head>
当页面加载时,不会显示任何警报。这些文件确实存在于正确的目录中,我没有收到firebug警告。由于某种原因,我使用registerScriptFile手动包含的所有JS文件都不起作用。没有我的插件,我已经包括工作。有什么想法吗

Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/custom', CClientScript::POS_HEAD);
而且脚本错误:

jQuery(function($) {
    alert('test');
});
必须工作

您可以尝试以下方法:

$(document).ready(function(){
alert('hello');
// Enter code here
});
在custom.js中

jQuery(function($) {
    alert('test');
});
$(document).ready(function(){
alert('hello');
// Enter code here
});