eval() in laravel not executing the string

2019-04-17 02:28发布

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条回答
▲ chillily
2楼-- · 2019-04-17 02:51

You need to add return when using eval.

Try:

eval("return $tempdata;");

Hope this helps!

查看更多
登录 后发表回答