I have large amount of data as string which includes text and lots of images.
The string includes specials tags like the following as well as normal text + images.
{{ title }}
I have a function which check if that string contains any php tags ?> or <?php
The function is
protected function parseTxt($text){
echo $text; //Gives me correct string
ob_start();
$result = eval('?>'.$text.'<?php ');
if ($result === false){
echo '<br />You have a syntax error.The snippet of text that contains
the error has been output below:<br />';
exit(str_replace(array('?>', '<?php '), '', $text));
}
return ob_get_clean();
}
I get the str as null.
I have php 5.5 and I have increased memory limit to 512
Please suggest as I am not having any alternative clue.Any help is highly appreciated.
Your code must be exiting before reaching ob_get_clean()
. Also, dont use eval. Just dont. Why dont you just echo $text
?
PS
eval is evil
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.