简体   繁体   English

Laravel 中的 eval() 不执行字符串

[英]eval() in laravel not executing the string

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()来执行查询当前集合。但是eval()没有执行它。

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

$tempdata contains the query that is in the database table. $tempdata 包含数据库表中的查询。

You need to add return when using eval.使用 eval 时需要添加return

Try:尝试:

eval("return $tempdata;");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM