Home  >  Article  >  Backend Development  >  请牛人帮忙,字段内的PHP语句如何执行呢

请牛人帮忙,字段内的PHP语句如何执行呢

WBOY
WBOYOriginal
2016-06-13 11:59:18894browse

请牛人帮忙,字段内的PHP语句怎么执行呢?

本帖最后由 wanmei12112121 于 2014-06-09 13:12:31 编辑 RT,实际环境是 一个PHP网页,通过查询数据库得到某个字段为$a,
但是在$a内实际是一行PHP语句,例如为  
怎么让
$a显示为 OK
而不是 呢?

不知道各位老大知不知道我像表达的意思呢?
------解决方案--------------------
$a = "<?php echo 'ok' ;?>";<br />eval("?>$a"); //ok

另外一种情况
$a = "echo 'ok' ;";<br />eval($a); //ok
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn