Problem about include some $str

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justin.he
Forum Newbie
Posts: 7
Joined: Wed Aug 09, 2006 2:32 am
Location: China

Problem about include some $str

Post by justin.he »

I have a variable like $str.
$str content is a php file Mixed some html. I want to include this $str to some php file.

Now I first make a file like aa.txt (content is $str) then include this file.But build a file is slowly and not the best way.

Anyother way to include this $str? (PS:the variable have some str like <?php echo $abc ?> so , you know...)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Problem about include some $str

Post by requinix »

I will rot in hell for suggesting this, but you could use eval().

Code: Select all

eval("?>" . $str);
In an effort to save my soul, is there a chance you can change the system so that this code is stored in a file instead?
justin.he
Forum Newbie
Posts: 7
Joined: Wed Aug 09, 2006 2:32 am
Location: China

Re: Problem about include some $str

Post by justin.he »

Thanks for you suggestion. I will try.
Post Reply