Home >Backend Development >PHP Tutorial >How to get the code of one php file from another php file in php? (rather than the execution result)

How to get the code of one php file from another php file in php? (rather than the execution result)

WBOY
WBOYOriginal
2016-09-15 11:30:551223browse

I hope the experts can give me some advice.

Reply content:

I hope the experts can give me some advice.

Just read the file.
For example, use file_get_contents

file read doesn’t work

file_get_contents
Curious why you do this?

In this case, I think you can use file_get_content to get the content in the file, and determine whether there is a .php item in the obtained content. If it exists, it proves that it is another file. Put together the path and open the file. Specifically, I haven’t tried it, it’s just an idea!

It’s just a file reading problem. Does it have anything to do with whether it is a php code file? The same goes for reading txt files

include require is to get the execution result
fopen is just to get the file content

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn