Link to home
Start Free TrialLog in
Avatar of ZumbaJr
ZumbaJrFlag for Brazil

asked on

PHP eval with img src

Hi Experts!

I´m looking for a way to render objects from database like this:

<?php
$v = '<img src="teste.png" />';
eval($v);
?>

but it doesn't works fine.

Any idea?

Thanks in advance.
Avatar of ziceva
ziceva
Flag of Romania image

Is this what you want?

<?php
$v = '<img src="teste.png" />';
echo $v;
?>
eval() runs the string passed to it as php code. Instead it looks like you should be using echo()

<?php
$v = '<img src="teste.png" />';
echo $v;
?>

Open in new window

Avatar of ZumbaJr

ASKER

I´m sorry!

I have some code php into database var like this:

<?php
$v = '<img src="<?php echo $rootfolder; ?>/teste.png" />';

???

?>

http://php.net/manual/en/function.eval.php

The code string to be evaluated. code_str does not have to contain PHP Opening tags.
ASKER CERTIFIED SOLUTION
Avatar of ziceva
ziceva
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial