dymon Posted November 25, 2009 Share Posted November 25, 2009 Hi, I want to include in the same php file, more php files (one by one), to cache the result, and the result to write in an other file, what I do: // For more files that I have, I do this $filename = <some file> ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); // Write contents to another static (html) file The problem is that I include more files, but they can have a function that repeats, so I get an error duplicate function. Why ob_end_clean() does not clean the buffer, as it would never exist. Any ideas? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/182889-include-multiple-files-with-the-same-function-name-in-it-using-ob_start/ Share on other sites More sharing options...
salathe Posted November 25, 2009 Share Posted November 25, 2009 The output buffering functions only act on output from your script; they have nothing to do with warnings or errors raised (by repeating function names, or anything else). The solution is just to not have repeating function names. Quote Link to comment https://forums.phpfreaks.com/topic/182889-include-multiple-files-with-the-same-function-name-in-it-using-ob_start/#findComment-965328 Share on other sites More sharing options...
dymon Posted November 25, 2009 Author Share Posted November 25, 2009 The thing is that I can not really control this thing about the functions (this is natural that this can happen) as the user will add this content. I want to overpass this somehow, to include the files independently some how. Quote Link to comment https://forums.phpfreaks.com/topic/182889-include-multiple-files-with-the-same-function-name-in-it-using-ob_start/#findComment-965329 Share on other sites More sharing options...
trq Posted November 25, 2009 Share Posted November 25, 2009 The thing is that I can not really control this thing about the functions (this is natural that this can happen) as the user will add this content. I want to overpass this somehow, to include the files independently some how. You can't. Don't create functions of the same name within the same namespace. Quote Link to comment https://forums.phpfreaks.com/topic/182889-include-multiple-files-with-the-same-function-name-in-it-using-ob_start/#findComment-965355 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.