Php import_request_variable stopped working

前端 未结 2 806
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 00:05

Hey everyone I was getting the following error on my web page:

Fatal error: Call to undefined function import_request_variables() in /demo/conn.php on line 5         


        
相关标签:
2条回答
  • 2020-12-22 00:26

    I wrote this replacement. It works for me. I hope it helps you. for example this URL : test.php?z=1

    import_request_variables("gp",'abc_');
    echo $abc_z; // 1
    function import_request_variables($g,$prfix)
    {
        foreach($_GET as $k => $v)
        {
            $v_name = $prfix.$k;
            global $$v_name;
            ${$prfix.$k} = $v;
        }
        foreach($_POST as $k => $v)
        {
            $v_name = $prfix.$k;
            global $$v_name;
            ${$prfix.$k} = $v;
        }
    }
    
    0 讨论(0)
  • 2020-12-22 00:35

    I had this problem from before, the work around that i did to fix it i replaced code before with code after that I've written below, so don't use import_request_variables it is deprecated in PHP 5.3 and in PHP 5.4 is removed as it is described in here http://uk3.php.net/import_request_variables, the following is the fix for the problem that i had:

    Code Before:

    import_request_variables('p');
    

    Code After (Replaced the code above with the code below):

    extract($_GET, EXTR_PREFIX_ALL, 'p');
    extract($_POST, EXTR_PREFIX_ALL, 'p');
    
    0 讨论(0)
提交回复
热议问题