Reintroduce $HTTP_POST_VARS in PHP 5.3

后端 未结 4 1589
生来不讨喜
生来不讨喜 2020-12-09 05:31

I need to run a legacy PHP application in a shared hosting environment. I have promised my customer I\'ll support that legacy application for some time but I found that it d

4条回答
  •  攒了一身酷
    2020-12-09 05:47

    You can do this

    config.php

    $HTTP_POST_VARS = &$_POST;
    $HTTP_GET_VARS = &$_GET;
    $HTTP_COOKIE_VARS = &$_COOKIE;
    

    .htaccess

    php_value auto_prepend_file /path/to/config.php
    

    PHP doc auto_prepend_file string

    Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require function, so include_path is used.

    The special value none disables auto-prepending.

    EDIT: To be extra thorough, these are the other superglobals that could also be aliased:

    $HTTP_SERVER_VARS = &$_SERVER;
    $HTTP_POST_FILES = &$_FILES;
    $HTTP_SESSION_VARS = &$_SESSION;
    $HTTP_ENV_VARS = &$_ENV;
    

提交回复
热议问题