Home > Backend Development > PHP Tutorial > PHP函数调用外部变量很怪的一个有关问题

PHP函数调用外部变量很怪的一个有关问题

WBOY
Release: 2016-06-13 13:38:03
Original
964 people have browsed it

PHP函数调用外部变量很怪的一个问题

PHP code
<!--

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

-->
$classfield="fadsdasf";
function echo_blocka(){
  global $classfield;
  echo $classfield;
}
echo_blocka();

Copy after login

这个在一个单独页面可以正常输出
但是在另一个包含页面什么也不输出,很郁闷。请高手分析一下原因。

------解决方案--------------------
另外一个页面的包含怎么个包含法?代码呢
------解决方案--------------------
探讨

我用帝国CMS做的,这个CMS可以直接在页面写PHP代码,
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