紫衣仙女
同一个页面内应该是在同一个作用域内的根据你的代码,你的QueryPrams应该是?submit=func1&num1=1&num2=3,你看一下是不是你的访问方式有问题补充一下相关测试结果<?php /**
* Created by PhpStorm.
* User: mscststs
* Date: 2018/8/13
* Time: 17:02
*/global $result;
$result = 0;if(isset($_GET['submit']) && $_GET['submit'] == 'func1'){
$num1 = $_GET['num1'] || 0;
$num2 = $_GET['num2'] || 0;
$result = $num1 + $num2; echo $_GET['num1']; echo $_GET['num2']; echo $num1.""; echo $num2."";
}?>
The result is: <?php
echo $result;?>输出是:1311 The result is: 2