Home > Backend Development > PHP Tutorial > php中define防止跳墙

php中define防止跳墙

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:30:17
Original
1388 people have browsed it

这个是入口shiyan.php

{

<code>define('ACC','true');
require('itshi.php');
include('shiyan.html');
</code>
Copy after login
Copy after login

}

itshi.php
{

<code>defined('ACC') || exit('ACC 未定义');
$take = 1888;
</code>
Copy after login
Copy after login

}

shiyan.html
{

<code><a href="two.php" target="_blank">点击我</a>
<div>
    <?php echo $take; ?>
</div>
<a href="shiyan.php" target="_blank">返回实验</a>
</code>
Copy after login
Copy after login

}

{
two.php

<code>require('itshi.php');
</code>
Copy after login
Copy after login

}
当我运行shiyan.php的时候,点击a标签进入two.php怎么提示ACC未定义啊,不是一开始就在shiyan.php就定义了ACC吗?

回复内容:

这个是入口shiyan.php

{

<code>define('ACC','true');
require('itshi.php');
include('shiyan.html');
</code>
Copy after login
Copy after login

}

itshi.php
{

<code>defined('ACC') || exit('ACC 未定义');
$take = 1888;
</code>
Copy after login
Copy after login

}

shiyan.html
{

<code><a href="two.php" target="_blank">点击我</a>
<div>
    <?php echo $take; ?>
</div>
<a href="shiyan.php" target="_blank">返回实验</a>
</code>
Copy after login
Copy after login

}

{
two.php

<code>require('itshi.php');
</code>
Copy after login
Copy after login

}
当我运行shiyan.php的时候,点击a标签进入two.php怎么提示ACC未定义啊,不是一开始就在shiyan.php就定义了ACC吗?

你的 two.php 时只包含了 itshi.php,而 itshi.php 里没定义 ACC 常量,也没有包含 shiyan.php 文件啊,当然提示 AAC 未定义了,你可以在 itshi.php 最上面 require 'shiyan.php'。

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template