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)
I hope the experts can give me some advice.
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