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

WBOY
Release: 2016-06-13 13:49:58
Original
1351 people have browsed it

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

PHP code
<!--

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

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


Copy after login

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

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

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

Copy after login

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

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

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

------解决方案--------------------
。。。。。
当然找不到了你没有运行a1();
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template