Home  >  Article  >  Backend Development  >  PHP动态包含文件的有关问题

PHP动态包含文件的有关问题

WBOY
WBOYOriginal
2016-06-13 13:49:581325browse

PHP动态包含文件的问题
index.php内容如下

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><?php function a1() {
    require_once '_t.php';
}
b1();



_t.php文件内容如下
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><?php function b1() {
    echo "dddddd";
}


这样调用会报错,找不到b1()函数,那要怎样才能实现这种动态包含一个文件,这个文件是个函数扩展库,在全局范围内能使用这个库中的函数

CodeIgniter这个框架里面Loader类就是这种动态加载库、类文件的,为什么它就能行呢?

------解决方案--------------------
b1(); 前,需要有 a1();

------解决方案--------------------
。。。。。
当然找不到了你没有运行a1();
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn