如何将数据从函数一传递到函数二

时间:2018-03-31 08:31:29

标签: php

我想将$ mine的值从一到二传递给任何人可以帮助我

function one($one_nr) {

        global $db;
        $query = "SELECT one_ward FROM ward WHERE ward_nr =".$db->qstr($one_nr);
        $exe = $db->Execute($query);
        while ($row = $exe->FetchRow()) {
                $get_ward = $row['one_ward'];
        }
        $mine = two($get_ward);

}

function two($mine) {

        var_dump($mine);die;
        global $db;

}

1 个答案:

答案 0 :(得分:0)

function one($one_nr) {
        global $db;
        $query = "SELECT one_ward FROM ward WHERE ward_nr =".$db->qstr($one_nr);
        $exe = $db->Execute($query);
        while ($row = $exe->FetchRow()) {
            $get_ward = $row['one_ward'];
        }
        $mine = two($get_ward);
}
function two($mine) {
        return var_dump($mine);
}