草庐IT

simple_bind_s

全部标签

php - Laravel - 如何使用绑定(bind)参数获取查询?

我可以通过这种方式获取非绑定(bind)查询:\DB::enableQueryLog();$items=OrderItem::where('name','=','test')->get();$log=\DB::getQueryLog();print_r($log);输出是:([0]=>Array([query]=>select*from"order_items"where"order_items"."name"=?and"order_items"."deleted_at"isnull[bindings]=>Array([0]=>test)[time]=>0.07))但我真正需要的是像这

php - 闭包中的后期静态绑定(bind) PHP5.5 vs 5.6

为什么newstatic在闭包中(在类static方法中)在PHP5.5中等于newself,而它是正确的在PHP5.6中绑定(bind)?给定:abstractclassParent{publicfunction__construct($something){$this->something=$something;}publicstaticfunctionmake($array){returnarray_map(function($el){returnnewstatic($el);},$array);}}classChildextendsParent{}然后Child::make($

php - 路由模型绑定(bind)可以与 RESTful Controller 一起使用吗?

我一直在使用RESTfulcontrollers在我的Laravel项目中。通过包括:Route::controller('things','ThingController')在我的routes.php中,我可以在ThingController中定义函数,例如:publicfunctiongetDisplay($id){$thing=Thing::find($id)...}这样GETtingURL"...things/display/1"将自动定向到Controller功能。这看起来非常方便,到目前为止对我来说效果很好。我注意到我的许多Controller功能都是从通过url的id获取

php - Mysqli 更新抛出 Call to a member function bind_param() 错误

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭3年前。我有一个70/80的字段表单,我需要将其插入到一个表中,所以我没有手动创建一个巨大的插入语句,而是首先根据表单中的输入名称在我的数据库中创建了一个表,这里是代码我用来创建/更改表的functioncreateTable($array,$memberMysqli){foreach($arrayas$key=>$value){//echo"K

PHP mysqli bind_param 文本类型

对于将用户评论转储到MySQL表中的反馈表单,我不确定将哪种bind_param类型用于用户提供的反馈文本(MySQL字段类型=文本)functionsql_ins_feedback($dtcode,$custip,$name,$email,$subject,$feedback){global$mysqli;if($stmt=$mysqli->prepare("INSERTINTOfeedback(dtcode,custip,name,email,subject,feedback)VALUES(?,?,?,?,?,?)")){$stmt->bind_param("ssssss",$dt

php - 查看父类的子类中是否存在静态属性(后期静态绑定(bind))?

父类中的代码:foreach(static::$_aReadOnlyDatabaseTablesAS$TableName=>$aColumns){//Dosomething}这在子类中定义了$_aReadOnlyDatabaseTables时有效,但在$_aReadOnlyDatabaseTables不存在时抛出错误。我需要先检查这个属性是否存在。我认为它应该是这样的:if(property_exists(static,$_aReadOnlyDatabaseTables)){foreach(static::$_aReadOnlyDatabaseTablesAS$TableName=>$

php - mysqli_stmt_bind_param SQL注入(inject)

使用preparedstatements和mysqli_stmt_bind_param是否还有注入(inject)风险?例如:$malicious_input='bob";droptableusers';mysqli_stmt_bind_param($stmt,'s',$malicious_input);在幕后,mysqli_stmt_bind_param将此查询字符串传递给mysql:SET@username="bob";droptableusers";或者它是否通过API执行SET命令,或者使用某种类型的保护来防止这种情况发生? 最佳答案

php - 动态绑定(bind)mysqli_stmt参数再绑定(bind)结果

我正在尝试动态绑定(bind)mysql_stmt参数并在关联数组中获取结果。我在StackOverflow上找到了这篇文章,其中Amber使用以下代码发布了一个答案:原帖:Howtomakeapropermysqliextensionclasswithpreparedstatements?“假设您实际上想要编写自己的版本(而不是利用其他答案建议的现有库之一——这些也是不错的选择)...这里有几个函数,您可能会发现检查它们很有用。第一个允许您将查询结果绑定(bind)到关联数组,第二个允许您传入两个数组,一个是有序的键数组,另一个是这些键的数据关联数组,并将该数据绑定(bind)到准备

PHP bind_params 为空

如果该变量存在,我正在尝试将参数绑定(bind)到INSERTINTOMySQLi准备语句,否则插入null。这是我拥有的,但它不起作用:if(!empty($name)){$result->bind_param('ss',$name,$url_friendly_name);}else{$result->bind_param('ss',null,null);}if(!empty($description)){$result->bind_param('s',$description);}else{$result->bind_param('s',null);}有没有人知道这样做的更好方法,

Php adLDAP 错误 - 无法绑定(bind)到服务器 : Strong(er) authentication required

我正在尝试使用PHPadLDAPversion4.04在公司网络上进行身份验证但尚未成功。PHP版本5.2.4我尝试了这个stackoverflow帖子PHPldap-Strong(er)authenticationrequired,运气不好。我不是这个域Controller的管理员;我只需要能够查询即可。我可以pingHOSTNAMEOFDC.domain.location.company.com(我的域Controller的FQDN)域Controller是WindowsServer2012R2Standard。我已经使用DsQuery和PowerShellAD模块成功查询了这个域