laravel中的eval()不执行字符串 [英] eval() in laravel not executing the string

查看:378
本文介绍了laravel中的eval()不执行字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库表包含一个雄辩的查询 单击此处查看数据库表快照 我已经从数据库中获取了查询,现在的问题是我无法执行集合中的查询. 我已经尝试过 eval()来执行查询以显示集合,但是 eval()并未执行它.

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包含数据库表中的查询.

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

推荐答案

使用eval时需要添加return.

You need to add return when using eval.

尝试:

eval("return $tempdata;");

希望这会有所帮助!

这篇关于laravel中的eval()不执行字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆