草庐IT

update_string

全部标签

php - mysqli_real_escape_string() 和 mysql_real_escape_string() 的区别

我已经阅读了无数文章,但想知道是否有人可以通俗易懂地向我解释其中的区别?我知道它们既可以防止sql注入(inject)又可以保证安全。但是如果我使用mysqli来运行查询,或者使用老式的my_sql_query方式,那么我使用哪一个真的很重要吗?它们不都是sql函数的包装器吗?为什么下面的代码不起作用?$test="hello,'there";$db->real_escape_string($test);$db->query("INSERTINTOusers(first_name)VALUES('$test')"); 最佳答案 它们

php - 即将到来的 SHA-256 : Do I need to update my IPN listener that does not use a secure URL?

我目前只使用支付按钮,以及我从https://github.com/paypal/ipn-code-samples获得的IPNphp脚本日期为2014年11月10日。我的脚本只是在没有加密的情况下回传到www.paypal.com。加密是否成为强制性要求? 最佳答案 您的IPN监听器将负责接收PayPal回调并将它们发送到PayPal进行验证。在这一点上,您的服务器与PayPal端点之间的连接将需要使用SHA-2进行加密。所以从字面上看是的,您需要检查您的服务器keystore/信任库并确保它包含SHA-2兼容证书。你可以引用这个P

php - OAuth2 token ,消息 : '{ "error": "access_denied" }' returned when I try to update Google Calendar using OAuth (Service Account)

我正在使用适用于PHP的Google标准库来使用日历服务,并且我已经通过GoogleAPI控制台为OAuth2.0身份验证设置了一个服务帐户类型。我的主要目标是通过批量更新用户的谷歌日历(例如:user@organisationname.com)(当用户不在线时)。例如。更新用户日历中的事件。当用户登录应用程序(使用OAuth2.0)时,他/她将为应用程序提供“管理您的日历”、“查看您的日历”和“在我不使用应用”以下代码用于使用OAuth2.0登录setApplicationName("GoogleCalendarPHPStarterApplication");$client->set

php - 我应该使用 mysqli_real_escape_string 还是应该使用准备好的语句?

这个问题在这里已经有了答案:HowcanIpreventSQLinjectioninPHP?(27个答案)关闭9年前。我应该使用mysqli_real_escape_string还是应该使用准备好的语句?我现在看到了一个解释准备语句的教程,但我看到它们做与mysqli_real_escape_string相同的事情,但它使用更多行准备好的报表有什么好处吗?您认为最好的使用方法是什么?

php - Codeigniter:与子域和 sess_time_to_update 共享 session

关于如何在子域之间或域与子域之间共享CI原生session存在很多问题。只是其中的一些:1,2,3每个人都说我们应该这样定义$config['cookie_domain']$config['cookie_domain']=".example.com";这似乎是正确的答案,但是......子域在两个域上更新时丢弃数据(值$config['sess_time_to_update']=300;)。在sess_time_to_update过期后,所有数据都会被丢弃。附加信息:CodeIgniter版本。2.1.4子域和域使用相同的文件(别名)。$config['sess_use_databas

php - 如何通过 PHP 和 String 函数获取所有 TD 值

这个问题在这里已经有了答案:ExtractdatafromHTMLtablerowcolumn(3个答案)关闭2年前。我需要从TD获取数据,变量是一个字符串:$string='abcdefghi';echo$td_num=substr_count($string,'');for($i=0;$i".$i."";$first_td[$i]=strpos($string,'');echo'Firstposition:'.$first_td[$i]."";$last_td[$i]=strpos($string,"");echo'Lastposition:'.$last_td[$i]."";$t

php - 无法在 Yii2 项目 : yiisoft/yii2 2. 上运行 'composer update' 0.7 需要 bower-asset/jquery 2.2.*@stable

我删除了我的vendor/目录并运行了composerupdate,但它给我一个错误。$composerupdateLoadingcomposerrepositorieswithpackageinformationUpdatingdependencies(includingrequire-dev)Yourrequirementscouldnotberesolvedtoaninstallablesetofpackages.Problem1-Therequestedpackagebower-asset/jquerycouldnotbefoundinanyversion,theremaybe

php - PHP 中的正则表达式 : find the first matching string

我想在非常非常长的文本中找到第一个匹配的字符串。我知道我可以使用preg_grep()并获取返回数组的第一个元素。但是如果我只需要第一场比赛(或者我知道提前只有一场比赛),这样做效率不高。有什么建议吗? 最佳答案 preg_match()?preg_match()returnsthenumberoftimespatternmatches.Thatwillbeeither0times(nomatch)or1timebecausepreg_match()willstopsearchingafterthefirstmatch.preg_m

php - 更改错误日志输出格式 : ini_set ('error_append_string' , 'string' ) 和 ini_set ('error_prepend_string' , 'string' ) 什么都不做

这是我告诉php要做的:希望我能在一个文件中报告所有错误,在消息前加上“PRE”,在消息后加上“APP”。(我的目标是把PRE和APP做成/n/r什么的。。。)但是我的报错日志是这样的:[14-May-201300:16:26]PHPNotice:Undefinedvariable:nonexistentvariablein/home/www/dir/index.phponline14[14-May-201300:16:28]PHPNotice:Undefinedvariable:nonexistentvariablein/home/www/dir/index.phponline14没

PHP PDO : Charset=UTF8 : An invalid keyword charset was specified in the dsn string

我正在使用sqlsrv驱动程序连接到带有PDO的MSSQL服务器。PHP版本为5.3.24。工作连接如下所示:$dsny="sqlsrv:Server=xx1;Database=xx2";$usery='xx3';$passwordy='xx4';$dbhy=newPDO($dsny,$usery,$passwordy);**但是我需要设置字符,然后我试试这个:$dsny="sqlsrv:Server=xx1;Database=xx2;charset=utf8";$usery='xx3';$passwordy='xx4';$dbhy=newPDO($dsny,$usery,$passw