So here's my idea. I have a class that takes a file, checks for a specific snippet, str_replaces it, and returns it back. Kind of like how a simplified smarty works with tag replacement
so for example if my index.php looks like:
<?php
include('file.php');
....
?>
it becomes:
<?php
include($myClass->edit('file.php');
....
?>
That works fine. But instead of that, would it be possible to have the actual include() function replaced by my own?
making it:
<?php
$myClass->myinclude('file.php');
....
?>
T开发者_C百科he myinclude() function in my class would be:
public function myinclude ($file) {
include($this->edit('file.php'));
}
But it doesn't work, I assume because I can't call the include from within the class and expect it to return back to the calling index.php file.
Is there some trick around this?
include is not a function but a language construct. When your php is executed the contents of included file (or even php executable strings) are copied at the point of inclusion.
精彩评论