如何让$ci 能在任何页面使用或者后台models里使用
以下是 CHTML 插件里的,我发现这个$ci 需要在 模块的 HTML.PHP 文件里传递
如果用在插件里,$ci->content_model->_Show 会报错,就找不到这个方法
如果让它在任意地方用起来呢?
$id = 41; $dirname = 'news'; ob_start(); // 修复前缀 $ci->content_model->_init($dirname,SITE_ID); // 生成静态路由纠正 \Phpcmf\Service::L('router')->class = 'show'; \Phpcmf\Service::L('router')->method = 'index'; \Phpcmf\Service::V()->init('pc'); \Phpcmf\Service::V()->module($ci->module['share'] ? 'share' : $ci->module['dirname']); \Phpcmf\Service::V()->assign('my_php_url', SITE_URL.'index.php?not301=2&'.($ci->module['share'] ? '' : 's='.$ci->module['dirname'].'&').'c=show&id='.$id); $data = $ci->content_model->_Show($id); $html = ob_get_clean();