【发布时间】:2014-02-18 08:21:53
【问题描述】:
//include.php
define('OPTION_0', 'Essence of population');
define('OPTION_1', 'Passport request/extend');
define('OPTION_2', 'Request logging concession');
//form.php
<select name="sort">
<option value="0"><?php echo(O_0) ?></option>
<option value="1"><?php echo(O_1) ?></option>
<option value="2"><?php echo(O_2 ?></option>
</select>
//show.php
extract($_POST); //The variable $sort has the value 1,2 or 3
echo("This is your choice");
echo(OPTION_ . $sort); //I want to use de constant e.g. OPTION_2
我想回显匹配常量的值。 因此,当我在 form.php 中选择第二个值时,它会为 $sort 提供 1 的值 现在我想使用常量 OPTION_1。
有人可以帮我吗?
【问题讨论】:
-
某种空洞常量的用途
标签: php variables post constants