how to pass a variable through the require() or include() function of php?

后端 未结 9 2095
梦如初夏
梦如初夏 2021-02-06 21:34

when I use this:

require(\"diggstyle_code.php?page=$page_no\");

the warning is :failed to open stream: No error in C:\\xampp\\htdocs\\4ajax\\ga

9条回答
  •  野性不改
    2021-02-06 22:18

    If your variable is global, there's no need to "pass"it, it is there already: PHP variable scope.

    The answer then is, don't do anything, if $page_no exists in the file in which you call require(), it will be available in the included file.

提交回复
热议问题