如何在此代码上回显`$ var`何时加载页面AAA.php?

时间:2014-11-27 16:59:29

标签: php

如何在此代码上回显$var何时加载页面AAA.php?

我测试了这段代码但没有回复555

AAA.php

<?php
  include('BBB.php');
  $number = 'iii';
  test($number);
?>

BBB.php

<?php
 function test($numeric)
 {
    if($numeric != '')
    {
        $x = '555';
        return $x;
    }
 }

$var = test($numeric);
echo $var;

?>

1 个答案:

答案 0 :(得分:2)

认为你在寻找这样的东西:

(因为你想要输出555

<?php

    function test($numeric) {
        if($numeric != '')
            return "555";
        else
            return false;
    }

    echo $var = test("test");

?>

输出:

555
顺便说一句:我会推荐你​​两件事:

错误报告

使用此:

<?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
?>

其次,这可能有助于阅读:

https://stackoverflow.com/help/how-to-ask

相关问题