草庐IT

name-binding

全部标签

php - $_SERVER ['SERVER_NAME' ] 有什么好的替代品吗?

我在PHPdocpages上阅读了以下评论:"BewarnedthatmostcontentsoftheServer-Array(even$_SERVER['SERVER_NAME'])areprovidedbytheclientandcanbemanipulated.TheycanalsobeusedforinjectionsandthusMUSTbecheckedandtreatedlikeanyotheruserinput."然后我在这里看到了一个话题onStackOverflowsayingthat$_SERVER['SERVER_NAME']ispartlyservercon

php - Binding参数如何防止Sql注入(inject)?

这个问题在这里已经有了答案:HowcanpreparedstatementsprotectfromSQLinjectionattacks?(10个答案)关闭6年前。在PHP中,我发现了一些防止Sql注入(inject)的方法。绑定(bind)参数就是其中之一。但是我无法找到关于绑定(bind)参数实际上如何防止Sql注入(inject)的完整解释。我认为绑定(bind)参数只是节省了将不同数据绑定(bind)到同一个Sql语句的时间。如何防止Sql注入(inject)?

php - 如何在 PHP PDO 中简单地将一个值绑定(bind)到所有参数?

我有以下函数functionsearchusers($username){$result=$this->conn->prepare("SELECTusername,profilimg,(SELECTCOUNT(title)FROManimelistWHEREmystatus='Watching'ANDaddedbyLIKECONCAT('%','?','%'))ASwatching,(SELECTCOUNT(title)FROManimelistWHEREmystatus='Completed'ANDaddedbyLIKECONCAT('%','?','%'))AScompleted,

php - MySQLi 绑定(bind)结果并获取多行

我正在尝试使用MySQLi和绑定(bind)/获取来遍历一组结果。staticfunctiongetConnection(){if(!isset(self::$db_conn)){self::$db_conn=newmysqli(self::$DBSERVER,self::$DBUSER,self::$DBPASS,ModelBase::$DBNAME)ordie(mysql_error(0)."Errorhandlingdatabaseconnection.");}returnself::$db_conn;}以上是getConnection()函数。它位于此类继承的ModelBase

PHP 在 PDOStatement::bindParam 中绑定(bind)重载属性时注意

当我尝试在PDOStatement::bindParam方法中绑定(bind)重载属性时,$stmt->bindParam(':'.$field.'',$this->$field,$pdoparam);...publicfunction__get($param){if(isset($this->$param))return$this->$param;}我收到通知Notice:IndirectmodificationofoverloadedpropertyMsgs::$posttimehasnoeffectin...经过一些研究,我发现了一个关于类似problem的错误报告在php.ne

php - PDO PostgreSQL 绑定(bind)错误

我发现当我尝试使用参数运行更新查询时,我遇到了错误inconsistenttypesdeducedforparameter可能是因为目标字段的类型(字符不同),一切都适用于text列类型。但我不想仅仅因为这个而改变列类型。然后我被告知我应该直接传递参数(使用bindValue或bindParam,确定每个值的类型)而不是将参数数组发送到execute方法。但是当我这样做的时候我得到了错误ERROR:bindmessagesupplies0parameters,butpreparedstatement"pdo_stmt_00000001"requires1测试代码为$Stmt=$DB->

php - Laravel Eloquent/Query Builder 中 LEFT JOIN 的 ON 子句中的参数化查询绑定(bind)

假设我想显示带有type="color"的完整奖项列表:AwardsType2013Winner=====================BlueAwardcolorTomRedAwardcolorGreenAwardcolorDan为了实现这个结果,我可以像这样在Laravel中进行查询:$year='2013';$awards=DB::table('awards')->leftJoin('winners',function($join)use($year){$join->on('awards.id','=','winners.award_id');$join->on('winner

php - 如何解除绑定(bind) laravel 类?

我像这样绑定(bind)一个类:App::bind('Some_Class','Other_Class')因此调用App::make('Some_Class')将返回'Other_Class'的一个实例。但是,稍后在脚本中我想恢复它,以便对make的调用现在将返回原始类。到目前为止,我已经尝试过这些:App::bind('Some_Class','Some_Class')App::bind('Some_Class',NULL)两者都没有用-它们似乎导致应用程序存储类的实例,这不好,因为我需要能够接受参数。如果在不带参数的情况下调用构造函数,则会触发fatalerror。那么,如何解除绑

PhpStorm:获取 "Methods with the same name as their class will not be constructors"的代码检查警告

好吧,我终于切换到PHP7。我的代码有点旧,会被翻新。一些问题是:classMagicClassfunctionMagicClass(){//etc}在执行过程中给出弃用警告:Deprecated:MethodswiththesamenameastheirclasswillnotbeconstructorsinafutureversionofPHP;MagicClasshasadeprecatedconstructorin这很好:classMagicClassfunction__construct(){//etc}如何让PhpStorm代码检查来警告我当前代码库中的此类错误?

php - Nginx 为静态文件代理不正确的 fastcgi_script_name

server{listenloc.app:80;root/app/frontend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_args$args;}location~^/admin{proxy_passhttp://127.0.0.1:81;}location~*\.php${#phpconf}}server{listen127.0.0.1:81;root/app/backend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_arg