require/include into variable

前端 未结 9 1580
萌比男神i
萌比男神i 2020-11-27 17:46

I want to require/include a file and retrieve its contents into a variable.

test.php



        
9条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 18:11

    require/include does not return the contents of the file. You'll have to make separate calls to achieve what you're trying to do.

    EDIT

    Using echo will not let you do what you want. But returning the contents of the file will get the job done as stated in the manual - http://www.php.net/manual/en/function.include.php

提交回复
热议问题