开发者

directory and __autoload function

开发者 https://www.devze.com 2023-04-06 02:49 出处:网络
$name = \'Model_Two\'; str_replace(\'_\',\'/\',$name); I need replace in __autoload function Model_Two to Two/Model_Two.class.php but i dont want using in autoload implode and explode how it work ?
$name = 'Model_Two';
str_replace('_','/',$name);

I need replace in __autoload function Model_Two to Two/Model_Two.class.php but i dont want using in autoload implode and explode how it work ? My functions have name Model_Two, Controller_Two and this is good. But my directory tree in framework , mvc is app/controllers/User/Controller_User.class.php.

I cant fi开发者_开发技巧nd method to repair my __autoload function. Maybe directory tree is wrong ?


Is this what you want?

require 'app/' . lcfirst(str_replace('_', 's/', $name)) . '/' . $name . '.php';


Use an existing naming convention and autoloader: PSR-0.

0

精彩评论

暂无评论...
验证码 换一张
取 消