eval() in laravel not executing the string

早过忘川 提交于 2019-12-06 17:05:45

问题


My database table contains an eloquent query click here to see Database Table Snapshot .I have fetched the query from database.Now problem is that I'm unable to execute the query that is in the collection. I have Tried eval() to execute the query present the collection.But eval() is not executing it.

  eval("\"$tempdata\";");

$tempdata contains the query that is in the database table.


回答1:


You need to add return when using eval.

Try:

eval("return $tempdata;");

Hope this helps!



来源:https://stackoverflow.com/questions/45979813/eval-in-laravel-not-executing-the-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!