PHP 'include' file -


I am working on a project that has many php files & lt; Php include calls through 'filename'; ? & Gt;

What I want to do is that I want a php function or code which includes all components with the actual file, so that all 6-7 files have a single PHP file , So having a single PHP file would be good in that context. Calling that file will create a new PHP file with all the included files.

I want to send an entire file to a file, as the administrator does! Any idea how to do this?

For example: -

  ... php-code ... & lt? Include Php 'dologin.php'; ? & Gt; ... php code will be converted to ...  

: -

  ... php code ... function dollar (); {. .. (dologin.php file) ... ... php code ...  

< P> You do not want to use the included () , which you essentially want to take, take a group of files and add them to one, the files are actually parse < There is no need for / em>, you need to open them, read to the end, and you have to paste in another file - until it is not done again.

Something like this:

  & lt ;? Php $ sources = array ('file1.php', 'file2.php', 'file3.php'); $ Out = FOPAN ('final.php', 'w +'); If ($ out === incorrect) dies ('output file can not be opened'); Forex Currency ($ source as $ source) {$ buff = file_get_contents ($ source); FILIT ($ out, $ buff); } Fclose ($ out); ? & Gt;  

Notes:

  • I check very little error here. If you can not open one of the source files, or what is the length of what you read, what happens besides this?
  • I'm checking very little error here. What happens if fwrite () fails?
  • I check very little error here. Is it safe to keep just as attached? Should the new lines be injected after each file is written in the output file? Do you make sure you disappear ? & Gt;
  • will not end with
  • I'm checking a very small error here. Is not an editor accidentally saving an input file in the beginning?

You will need to do something like with , and unlink it once (though fopen () The flag sent to will be reduced, which is why I went with that family of different functions from the convenience of file_get_contents () ). For more information about how they work, check the manual.

Honestly, though - Depending on your platform, a simple shell script may be sufficient I a lot make sure that you do so with additional information you edit in your question Are trying.


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -