PHP function use variable from outside

前端 未结 4 1422
眼角桃花
眼角桃花 2020-11-30 00:08
function parts($part) { 
    $structure = \'http://\' . $site_url . \'content/\'; 
    echo($tructure . $part . \'.php\'); 
}

This function uses a

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 01:01

    Just put in the function using GLOBAL keyword:

     global $site_url;
    

提交回复
热议问题