我想在另一个开源项目(moodle,joomla,......)中使用Yii函数 . 所以我可以从Yii强大的模型中受益 . 我将以下代码放在其中一个文件中( ROOT/course/edit.php ):

$yii = dirname(__FILE__) . '/../mws/framework/yii.php';
$config = dirname(__FILE__) . '/../mws/protected/config/main.php';
defined('YII_DEBUG') or define('YII_DEBUG', TRUE);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once($yii);
Yii::createWebApplication($config);

但我得到以下错误:

PHP警告包括(edit.php.php)[function.include]:无法打开流:没有这样的文件或目录D:\ WAMP \ www \ millms \ mws \ framework \ YiiBase.php(427)415 {416包括($类文件); 417 if(YII_DEBUG && basename(realpath($ classFile))!== $ className.'.php')418抛出新的CException(Yii :: t('yii','类名“”与类不匹配file“” . ',array(419''=> $ className,420''=> $ classFile,421))); 422休息; 423} 424} 425} 426 else 427 include($ className . ' . php'); 428} 429 else //在PHP 5.3中使用命名空间的类名称430 430 {431 $ namespace = str_replace('',' . ',ltrim($ className,'')); 432 if(($ path = self :: getPathOfAlias($ namespace))!== false)433 include($ path . ' . php'); 434其他435返回false; 436} 437返回class_exists($ className,false)|| interface_exists($类名,FALSE); 438} 439返回true;堆栈跟踪#0 D:\ WAMP \ www \ millms \ mws \ framework \ YiiBase.php(427):YiiBase :: autoload()#1 unknown(0):YiiBase :: autoload(“edit.php”)#2 unknown(0):spl_autoload_call(“edit.php”)#3 - D:\ WAMP \ www \ millms \ lib \ formslib.php(831):is_a(“edit.php”,“moodle_url”)826 static $ formcounter = 1; 827 828 HTML_Common :: HTML_Common($ attributes); 829 $ target =空($ target)? array():array('target'=> $ target); 830 $ this - > _ formName = $ formName; 831 if(is_a($ action,'moodle_url')){832 $ this - > _ pageparams = $ action-> hidden_params_out(); 833 $ action = $ action-> out(true); 834} else {835 $ this - > _ pageparams =''; 836}#4 - D:\ WAMP \ www \ millms \ lib \ formslib.php(115):MoodleQuickForm-> MoodleQuickForm(“course_edit_form”,“post”,“edit.php”,“”,...)110 $ action = strip_querystring(qualified_me()); 111} 112 113 $ this - > _ formname = get_class($ this);保留//'_form'后缀以防止表单id与其他元素114的碰撞$ this - > _ customdata = $ customdata; 115 $ this - > _ form =&new MoodleQuickForm($ this - > _ formname,$ method,$ action,$ target,$ attributes); 116 if(!$ editable){117 $ this - > _ form-> hardFreeze(); 118 $ 119 $ this-> set_upload_manager(new upload_manager()); 120#5 - D:\ WAMP \ www \ millms \ course \ edit.php(448):moodleform-> moodleform(“edit.php”,array(“course”=> null,“category”=> stdClass)) 443} 444} 445 446 447 ///首先创建表格448 $ editform = new course_edit_form('edit.php',compact('course','category')); 449 //现在覆盖默认值如果课程已经存在450 if(!empty($ course)){451 $ course-> enrolpassword = $ course-> password; //我们需要一些其他名称的密码字段MDL-9929 452 $ editform-> set_data($ course); 453}

How I can Create A raw Yii Application Object?