Bug #63026 [Com]: require_once error
Edit report at https://bugs.php.net/bug.php?id=63026&edit=1 ID: 63026 Comment by: ian dot xspace at yahoo dot cn Reported by:ian dot xspace at yahoo dot cn Summary:require_once error Status: Feedback Type: Bug Package:*Compile Issues Operating System: windows 7 PHP Version:5.3.16 Block user comment: N Private report: N New Comment: return array( 'M'=>'MODELS', 'V'=>'VIEWS', 'C'=>'CTRLS', 'L'=>'LIBS', 'P'=>'PLNS', 'H'=>'HLP' ); å ³é®æ¯è¿ç§æ åµä¸æè°ç¨å¾å¤ç±»é½æåäºï¼ä¸æ¯åºè¯¥å¤±è´¥çåï¼ä¸é¢ææ¯æ£ç¡®åæ³ return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); Previous Comments: [2012-09-12 10:30:46] re...@php.net â$obj = $this->loadCS('M.share_model');//è°ç¨å ¶å®ç±» //ä½ å¯ä»¥å¤è°ç¨å 个类ï¼å¨ä¸é¢é误åæ³æ åµä¸ï¼æçç±»å¯ä»¥è°ç¨æåï¼æç失败 //sysModule éç对åºå ³ç³»ï¼åºè¯¥è¿ä¹å'C'=>CTRLS,åè æ éå¼å· â require_onceçè·¯å¾æ¯ç´æ¥æ¼çï¼èä¸ä¸æ¯autoloadï¼ ä»è¿é没æå ¶ä»çä¾åï¼å¦æé¨åç±»å大å°åéäºï¼å°±ä¼åºç°é¨åç±»æ¾ä¸å°çæ åµã å¨requireåå¢å 个æ£æ¥å°±è½ç¡®è®¤æè æé¤è¿ä¸ªé®é¢äº [2012-09-12 10:25:08] larue...@php.net ä½ ä»åªéçåºæ¥å大å°åæå ³ç³»ç? [2012-09-12 10:15:04] re...@php.net çä½ è¿æ åµï¼æå¯è½æ¯ä½ ç大å°åé®é¢ï¼ ä½ æ¯ç´æ¥require_onceçï¼å¦æ大å°åéäºæ¯æé®é¢çã 为äºå¥½è°è¯ï¼ä½ å¯ä»¥å¨require_once åå ä¸ä¸ªif(!file_exists($file) {die($file not found)} æ£æ¥ä¸ä¸ã ä½ ç¡®è®¤ä¸ä¸æ件çç¡®åå¨å§ã åæ¶ï¼æ¯å¨ä¸è¡ï¼æä½ ç代ç å®æ´æå ä¼ å°æ个å°æ¹å§ãã [2012-09-12 02:03:08] larue...@php.net é£äºç±»åå¯ä»¥æ£ç¡®å è½½ ,é£äºç±»åä¸å¯ä»¥? ä½ ä¸¾ä¸ªä¾å? [2012-09-12 01:56:19] ian dot xspace at yahoo dot cn //init.php å®ä¹ç½ç«ç®å½ /***ç½ç«ç®å½å®ä¹***/ define('THEME', 'default'); //define('TEMP', WEB_ROOT.DS.'temp'); //define('LIBS', WEB_ROOT.DS.'libs'); define('VIEWS', WEB_ROOT.DS.'views'); define('LOGS', VIEWS.DS.'logs'); define('DYN', VIEWS.DS.'dynamic'); define('HLP', WEB_ROOT.DS.'helpers'); //define('PLNS', WEB_ROOT.DS.'plugins'); define('CONFS', WEB_ROOT.DS.'configs'); define('MODELS', WEB_ROOT.DS.'models'); define('CTRLS', WEB_ROOT.DS.'controls'); //SYS.php sysModuleå½æ°éç对åºå ³ç³»ä¸ºé误åæ³ï¼æ£ç¡®åæ³åºè¯¥æ¯'M'=>MODELSåè æ éåå¼å· class SYS { //sysModuleç³»ç»ç®å½æ å° private function sysModule() { return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } //getSysè·åç¸åºé ç½® public static function getSys($fun) { return self::$fun(); } } //common.php å ¶ä¸ä¸ä¸ªå½æ°ï¼å è½½æéè¦çç±» class Common { //loadCS protected function loadCS($cs) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //ç´æ¥å®ä½ require_once($moArr[$type].DS."{$csName}.php"); // switch($type) 以ä¸å°ä¼è·åæ´å¿«æ§è¡é度 // { // case 'M': // require_once(MODELS.DS."$csName.php"); // break; // case 'V': // require_once(VIEWS.DS."$csName.php"); // break; // case 'C': // require_once(CTRLS.DS."$csName.php"); // break; // case 'L': // require_once(LIBS.DS."$csName.php"); // break; // case 'P': // require_once(PLNS.DS."$csName.php"); // break; // case 'H': // require_once(HLP.DS."$csName.php"); // break; // default: // JS::willJS('alertMsg', 'è°ç¨å¤±è´¥!'); //
Bug #63026 [Com]: require_once error
Edit report at https://bugs.php.net/bug.php?id=63026&edit=1 ID: 63026 Comment by: ian dot xspace at yahoo dot cn Reported by:ian dot xspace at yahoo dot cn Summary:require_once error Status: Feedback Type: Bug Package:*Compile Issues Operating System: windows 7 PHP Version:5.3.16 Block user comment: N Private report: N New Comment: //init.php å®ä¹ç½ç«ç®å½ /***ç½ç«ç®å½å®ä¹***/ define('THEME', 'default'); //define('TEMP', WEB_ROOT.DS.'temp'); //define('LIBS', WEB_ROOT.DS.'libs'); define('VIEWS', WEB_ROOT.DS.'views'); define('LOGS', VIEWS.DS.'logs'); define('DYN', VIEWS.DS.'dynamic'); define('HLP', WEB_ROOT.DS.'helpers'); //define('PLNS', WEB_ROOT.DS.'plugins'); define('CONFS', WEB_ROOT.DS.'configs'); define('MODELS', WEB_ROOT.DS.'models'); define('CTRLS', WEB_ROOT.DS.'controls'); //SYS.php sysModuleå½æ°éç对åºå ³ç³»ä¸ºé误åæ³ï¼æ£ç¡®åæ³åºè¯¥æ¯'M'=>MODELSåè æ éåå¼å· class SYS { //sysModuleç³»ç»ç®å½æ å° private function sysModule() { return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } //getSysè·åç¸åºé ç½® public static function getSys($fun) { return self::$fun(); } } //common.php å ¶ä¸ä¸ä¸ªå½æ°ï¼å è½½æéè¦çç±» class Common { //loadCS protected function loadCS($cs) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //ç´æ¥å®ä½ require_once($moArr[$type].DS."{$csName}.php"); // switch($type) 以ä¸å°ä¼è·åæ´å¿«æ§è¡é度 // { // case 'M': // require_once(MODELS.DS."$csName.php"); // break; // case 'V': // require_once(VIEWS.DS."$csName.php"); // break; // case 'C': // require_once(CTRLS.DS."$csName.php"); // break; // case 'L': // require_once(LIBS.DS."$csName.php"); // break; // case 'P': // require_once(PLNS.DS."$csName.php"); // break; // case 'H': // require_once(HLP.DS."$csName.php"); // break; // default: // JS::willJS('alertMsg', 'è°ç¨å¤±è´¥!'); // } $CS = ucfirst($csName); return new $CS(); } } //index.php é¦é¡µè°ç¨å ¶å®ç±» //Index class Index extends IAN_C { //__construct public function __construct() { $obj = $this->loadCS('M.share_model');//è°ç¨å ¶å®ç±» //ä½ å¯ä»¥å¤è°ç¨å 个类ï¼å¨ä¸é¢é误åæ³æ åµä¸ï¼æçç±»å¯ä»¥è°ç¨æåï¼æç失败 //sysModule éç对åºå ³ç³»ï¼åºè¯¥è¿ä¹å'C'=>CTRLS,åè æ éå¼å· } } new Index //大å¥ä½ è¦æ¯åçä¸æç½ï¼æä¹æ²¡è¾äº Previous Comments: [2012-09-12 01:48:03] ian dot xspace at yahoo dot cn æ©è¯´åï¼æè¿ä»¥ä¸ºé½æ¯å¤å½äººå¢ã //å®ä¹ç½ç«è·ç®å½ init.php define('WEB_ROOT', strtr(dirname(__FILE__), '\\', '/')); //å®ä¹ç½ç«çå ¶å®ç®å½ define('TEMP', WEB_ROOT.DS.'temp'); define('LIBS', WEB_ROOT.DS.'libs'); define('VIEWS', WEB_ROOT.DS.'views'); //ä¸é¢æ¯æåçä¸ä¸ªç±» sys.php class SYS { //è¿ä¸ªæ¯æ¯ä¸ªç®å½å¯¹åºçç®åï¼ä½æ¯è¿æ¯é误åæ³ï¼å¯å¨åæçç¨åºè°ç¨ä¸å± ç¶æç //å¯ä»¥æåæçå¤±è´¥äº $moArr = SYS::getSys('sysModule'); //require_once($moArr[$type].DS."{$csName}.php"); è¿æ ·å¯ä»¥ç´æ¥ //å¼å ¥æéè¦çæ件ï¼é¿å 使ç¨switch浪费æ¶é´ /* // switch($type) 以ä¸å°ä¼è·åæ´å¿«æ§è¡é度 // { // case 'M': // require_once(MODELS.DS."$csName.php"); // break; // case 'V': // require_once(VIEWS.DS."$csName.php"); // break; // case 'C': // require_once(CTRLS.DS."$csName.php"); // break; // case 'L': // require_once(LIBS.DS."$csName.php"); // break; // case 'P': // require_once(PLNS.DS."
Bug #63026 [Com]: require_once error
Edit report at https://bugs.php.net/bug.php?id=63026&edit=1 ID: 63026 Comment by: ian dot xspace at yahoo dot cn Reported by:ian dot xspace at yahoo dot cn Summary:require_once error Status: Feedback Type: Bug Package:*Compile Issues Operating System: windows 7 PHP Version:5.3.16 Block user comment: N Private report: N New Comment: æ©è¯´åï¼æè¿ä»¥ä¸ºé½æ¯å¤å½äººå¢ã //å®ä¹ç½ç«è·ç®å½ init.php define('WEB_ROOT', strtr(dirname(__FILE__), '\\', '/')); //å®ä¹ç½ç«çå ¶å®ç®å½ define('TEMP', WEB_ROOT.DS.'temp'); define('LIBS', WEB_ROOT.DS.'libs'); define('VIEWS', WEB_ROOT.DS.'views'); //ä¸é¢æ¯æåçä¸ä¸ªç±» sys.php class SYS { //è¿ä¸ªæ¯æ¯ä¸ªç®å½å¯¹åºçç®åï¼ä½æ¯è¿æ¯é误åæ³ï¼å¯å¨åæçç¨åºè°ç¨ä¸å± ç¶æç //å¯ä»¥æåæçå¤±è´¥äº $moArr = SYS::getSys('sysModule'); //require_once($moArr[$type].DS."{$csName}.php"); è¿æ ·å¯ä»¥ç´æ¥ //å¼å ¥æéè¦çæ件ï¼é¿å 使ç¨switch浪费æ¶é´ /* // switch($type) 以ä¸å°ä¼è·åæ´å¿«æ§è¡é度 // { // case 'M': // require_once(MODELS.DS."$csName.php"); // break; // case 'V': // require_once(VIEWS.DS."$csName.php"); // break; // case 'C': // require_once(CTRLS.DS."$csName.php"); // break; // case 'L': // require_once(LIBS.DS."$csName.php"); // break; // case 'P': // require_once(PLNS.DS."$csName.php"); // break; // case 'H': // require_once(HLP.DS."$csName.php"); // break; // default: // JS::willJS('alertMsg', 'è°ç¨å¤±è´¥!'); // } */ //è¿éæ¯ç³»ç»ç®å½å¯¹åºçåè¯ç®åï¼ä½æ¯è¿æ¯é误åæ³ //æ£ç¡®åæ³åºè¯¥æ¯ 'M'=>MODELS åé¢æ éå åå¼å·ï¼è½ç¶æ¯é误åæ³ä½æ¯ä½¿ç¨çæ¶å //æçå¯ä»¥æ£å¸¸ä½¿ç¨æçä¸è½æ£å¸¸ä½¿ç¨ï¼ private function sysModule() { return array( 'M'=>'MODELS', 'V'=>'VIEWS', 'C'=>'CTRLS', 'L'=>'LIBS', 'P'=>'PLNS', 'H'=>'HLP' ); } public static function getSys($fun) { return self::$fun(); } } //common.php å ¶å®ç¨åºå ±äº«ç±» class Common { //ç±»ä¸çä¸ä¸ªå½æ°ç¨äºè°ç¨æéè¦çå ¶ä»ç±» public function loadSomeClass($type) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //find module require_once($moArr[$type].DS."{$csName}.php"); } } //index.php æ¯å¦å¨index.php页é¢éè°ç¨å ¶ä»ç±»æ件 class Index { public function __construct() { require_once 'common.php'; $com = new Common(); $com->loadSomeClass('M.db_model');//å¼å ¥è¿ä¸ªç±»æ件æè mvcéçä»»ä½ä¸ä¸ªæ件 //é®é¢å°±åºå¨è¿é 'M'=>'MODELS', è¿ç§åæ³æ¯æéçï¼ä½æ¯è°ç¨loadSomeClass //æ¶åå± ç¶æçç±»å¯ä»¥æ£ç¡®å è½½èæçç±»ä¸è½æ£ç¡®å è½½ } } new Index(); //è¦æ¯è¿çä¸æåï¼ä½ åè¯æä»åªéä¸ä¼ æ件åï¼æè æçQQæ¯995668790ï¼ä»¥åæå¨ä½ çå客éåä½ èè¿ian,就说æbugç Previous Comments: [2012-09-10 07:53:37] larue...@php.net ä½ ç¨ä¸ææè¿°å§, æå®å¨çä¸æä½ è¯´ä»ä¹é误 å¦å¤, 请æä¾ä¸ä¸ªå¯ä»¥æ£å¸¸è¿è¡çå¯éè¯èæ¬. (you can re-describe this problem in chinese, previous one is hard to read). thanks [2012-09-10 07:44:44] ian dot xspace at yahoo dot cn private function sysModule() { //error writing é误åæ³ return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); //right wring æ£ç¡®åæ³ return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } //common.php load some calss file //Assume $type = 'M.className'; function loadSomeClass($type) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $m
Bug #63026 [Com]: require_once error
Edit report at https://bugs.php.net/bug.php?id=63026&edit=1 ID: 63026 Comment by: ian dot xspace at yahoo dot cn Reported by:ian dot xspace at yahoo dot cn Summary:require_once error Status: Feedback Type: Bug Package:*Compile Issues Operating System: windows 7 PHP Version:5.3.16 Block user comment: N Private report: N New Comment: private function sysModule() { //error writing é误åæ³ return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); //right wring æ£ç¡®åæ³ return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } //common.php load some calss file //Assume $type = 'M.className'; function loadSomeClass($type) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //find module require_once($moArr[$type].DS."{$csName}.php"); //Error wording actually some successful and some not successful //å¨é误åæ³ä¸å± ç¶æçè½æåæçä¸è½æå } Previous Comments: [2012-09-07 17:19:21] larue...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with , is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. [2012-09-07 05:28:30] ian dot xspace at yahoo dot cn Description: 'MODELS', 'V'=>'VIEWS', 'C'=>'CTRLS', 'L'=>'LIBS', 'P'=>'PLNS', 'H'=>'HLP' ); } public static function getSys($fun) { return self::$fun(); } } //common.php load some calss file //Assume $type = 'M.className'; function loadSomeClass($type) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //find module require_once($moArr[$type].DS."{$csName}.php"); } //bugs: In accordance with the above wording some successful and some can not successfully ? /* private function sysModule() { return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } */ ?> Test script: --- 'MODELS', 'V'=>'VIEWS', 'C'=>'CTRLS', 'L'=>'LIBS', 'P'=>'PLNS', 'H'=>'HLP' ); } public static function getSys($fun) { return self::$fun(); } } //common.php load some calss file //Assume $type = 'M.className'; function loadSomeClass($type) { $csName = substr($cs, 2); $type = strtoupper(strtok($cs, '.')); $moArr = SYS::getSys('sysModule'); //find module require_once($moArr[$type].DS."{$csName}.php"); } //bugs: In accordance with the above wording some successful and some can not successfully ? /* private function sysModule() { return array( 'M'=>MODELS, 'V'=>VIEWS, 'C'=>CTRLS, 'L'=>LIBS, 'P'=>PLNS, 'H'=>HLP ); } */ ?> Expected result: private function sysModule() { return array( 'M'=>'MODELS', 'V'=>'VIEWS', 'C'=>'CTRLS', 'L'=>'LIBS', 'P'=>'PLNS', 'H'=>'HLP' ); } error writing! why require_once some successful and some error -- Edit this bug report at https://bugs.php.net/bug.php?id=63026&edit=1