You are here: Re: eval, include and output buffering « PHP Programming Language « IT news, forums, messages
Re: eval, include and output buffering

Posted by Chung Leong on 05/10/07 16:00

On May 10, 4:29 pm, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> I'm using eval to excute some mixed php and html code but I cannot debug it.
> I am essentially using filegetcontents to load up a php/html file and then
> inserting it into another php/html file and then using eval to execute the
> final product.
>
> If I were to use include and output buffering instead of filegetcontents
> would it allow be to debug the code? (I have to capture the include so it
> can be modified which is why I used filegetcontents and eval in the first
> place).
>
> essentially instead of something like eval(mod(filegetcontents()))
>
> I would have
>
> ob_start();
> include $filename;
> $contents = mod(ob_get_contents());
> ob_end_clean();
>
> As far as I can remember mod only modifies html code but I can't be
> completely sure. In any case I'm not sure how the include eval the code when
> its buffered as if its just the output or what? Right now everythign is
> working fine and I don't want to screw it up but I'm kinda dragging my feet
> because of the debugging issues.
>
> Thanks,
> Jon

An alternative to using eval() is to implement a stream wrapper, then
using include/require on a custom URL. What I would do is save the
generated content to a temporary file during debug so that you can
more easily see where an error occur.

See http://www.php.net/manual/en/ref.stream.php

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация