Call PHP function from url?

前端 未结 14 1635
清歌不尽
清歌不尽 2020-12-04 15:50

If I want to execute a php script, i just point the browser to www.something.com/myscript.php

But if i want to execute a specific function inside

14条回答
  •  感动是毒
    2020-12-04 16:12

    One quick way is to do things like

    something.com/myscript.php?f=your_function_name
    

    then in myscript.php

    if(function_exists($_GET['f'])) {
       $_GET['f']();
    }
    

    But please, for the love of all kittens, don't abuse this.

提交回复
热议问题