Home  >  Article  >  Backend Development  >  php 有关问题 高分求解

php 有关问题 高分求解

WBOY
WBOYOriginal
2016-06-13 10:11:26888browse

php 问题 高分求解
实现功能:在php A页面定义一个global $aaa变量,需要在php B页面使用变量$aaa的值,如何解决。

------解决方案--------------------
B include A....可以嗎? 還是能夠傳值?又或者來個 cookie? session?
------解决方案--------------------
看什么写法吧.. 如过是 2个 
页面 只要 require 或者 include 就好了
------解决方案--------------------
除了 session ,cookie, get, post 可以说没有其他方法..
------解决方案--------------------
session / cookies 吧
------解决方案--------------------

探讨

除了 session ,cookie, get, post 可以说没有其他方法..

------解决方案--------------------
变量的作用域,

任何在类,函数之外的变量,都是$GLOBAL 变量!

另外还有系统超级全局变量。 $_GET, $_POST,之类的。具有全局作用域!
------解决方案--------------------
你这个得用cookie或session来实现了。
------解决方案--------------------
include或者require过来就好了
------解决方案--------------------
session cookie 全局变量

给我点分吧,多谢
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