关于include

WBOY
WBOYOriginal
2016-06-23 14:10:181018browse

1.php:
.....
include(co.php);
echo ..
...

2.php:
.....
include(co.php);
echo ..
...


请教高手一个问题

对于在co.php申明的变量当co.php被其他文件(这里是1.php和2.php)include时,是不是每次都会再重新申明同样名称的变量?还是co.php先申明此变量后其他文件就可以直接用此变量了?


回复讨论(解决方案)

可以看做  在include  的位置 直接写入 include内的代码

每次都会再重新申明同样名称的变量

能直接用,include,就等于把那文件的内容写到include那处

那我想申明一个变量好后其它php文件可以直接使用此变量应该怎么操作呢?

include 后,直接引用就是了。

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
Previous article:PHP与文本域Next article:求一个简单的数据抓取工具