Home > Backend Development > PHP Tutorial > php 变量传递

php 变量传递

WBOY
Release: 2016-06-13 12:05:23
Original
980 people have browsed it

php 变量传递 求助?
请问下   我建立了一个公共的文件用于保存信息 conn.php

$isLog = true;

我想在a.php中把$isLog = false;

但是我在b.php中查询$isLog还是true


请问下 是不是没理解对  
------解决方案--------------------
要达到你要的效果,用session存吧。
------解决方案--------------------
conn.php文件内的$isLog = true;

你在a.php引用conn.php,把值改成false 但是conn.php文件本身的值没有改变
在你b.php重新引用conn.php 的时候 获取的值肯定还是true

要达到你的效果,用get传递、用session都可以
------解决方案--------------------
如果想要在页面改变加载变量的值,只需在当前页面重写该变量,注意加载页面和重写变量顺序。

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