? 在CodeIgniter中,一般来说,是要在控制层中调用library的,但假如要在
视图层调用library的话,比如:
?? $this->load->library(‘some_library’);
这样调用,按道理说是违反MVC的,但假如要确实调用的话,上面调用也是错误的,会
显示:
?? PHP Fatal error:? Call to a member function some_library_function() on a non-object in …….php file.
?? 而要如下方式调用:
?? $ci_obj = & get_instance();
$ci_obj->load->library('some_library');
$ci_obj->some_library->some_library_function();
? 或者写成方法:
? function load_library($library_name) {
$ci = & get_instance();
$ci->load->library($library_name);
return $ci->$library_name;
}
详细解决方案
CI中在瞧图层直接调用library
热度:365 发布时间:2013-11-08 17:51:58.0
相关解决方案
- SonyEricsson_W800 Couldn't load zayitlib.dll library?解决思路
- LINQ to sQL:业务层多个Class Library,or 只用一个?该如何解决
- 企业库的优缺点?Enterprise Library,该如何解决
- magaView.HasMonth = db.Library.GroupBy(a => a.TimeBook.Month).Select(a => a.Key),该怎么处理
- 关于Enterprise Library 4.1的安全跟错误处理
- Enterprise Library 2.0 连接 access2003 Web.Config配置有关问题
- 使用 DataAccessApplicationBlock好? 还是使用 Enterprise Library 中的数据库访问助手类好?该如何处理
- 求教enterprise library -data access application block的有关问题
- Enterprise Library 2.0中怎么设置SQL命令超时
- Enterprise Library 2.0 怎么按照天来写日子
- 关于Enterprise Library 2.0 怎么引用
- 是这样写吗? Library.Take(count).Where(a => a.Status==status)
- Blackberry 下怎么使用第三方 Library (jar)
- DB2 ERROR: no db2jcct2 in java.library.path解决思路
- DB2 ERROR: no db2jcct2 in java.library.path解决方案
- 关于“The type * is not accessible due to restriction on required library”有关问题的解决
- 【转】关于“The type * is not accessible due to restriction on required library”有关问题的
- 运行jsp项目出现The Apache Tomcat Native library not found错误应该怎么修 ...
- JavaScript 工具库:Cloudgamer JavaScript Library v0.1 发布解决方案
- zend framework library 显示异常
- apache 启动时提示 Unable to load dynamic library 'f:\php\php_iconv.dll' -'找不到指定程序解决思路
- web-inf的lib包引出到工程web app library
- struts中异常Error in using tag library uri=WEB-INF struts-html.tld prefix=htm
- [JACOB] ->no jacob in the java.library.path错误
- Ext JS Library 2.0.2可编辑表格中如何显示combo的Text
- 怎么在开发纯富客户端(RIA)应用的时候利用标签库(tab library)
- No tag "datetimepicker" defined in tag library imported with prefix "s"
- no JSTAF in java.library.path的解决方法
- no SDKAPIJava in java.library.path,该如何处理
- java.library.path VS java.class.path,该如何处理