Not able to GET parameters functioning in include_once

后端 未结 1 1730
被撕碎了的回忆
被撕碎了的回忆 2021-01-20 01:42

when i call include once without any GET parameters it works but with setting GET parameters on trackinglogs.php nothing happens please suggest me what do to..

my

1条回答
  •  太阳男子
    2021-01-20 02:36

    You cannot pass parameters when including like that, include does not make an HTTP request.

    The most minimal solution, although I do not recommend it, is to simply set the parameters yourself so that trackinglogs.php finds them:

    $_GET['todo'] = 'setcookie';
    include_once('trackinglogs.php');
    

    A much better solution would be to put the code that tracks logs inside a function, and call that providing this operating parameters at the same time. So you 'd have something like:

    And you would do:

    include_once('trackinglogs.php');
    track('setcookie');
    

    0 讨论(0)
提交回复
热议问题