how do I assign content from readfile() into a variable?

后端 未结 2 520
孤城傲影
孤城傲影 2021-01-13 02:34

readfile() says it outputs the content but I want the content to be saved in a variable. How do I do that? I tried $content=readfile(\"file.txt\") but that doesn\'t come out

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 03:29

    readfile() writes the contents of the file to a buffer. Use file_get_contents() instead.

提交回复
热议问题