草庐IT

regex_token_iterator

全部标签

php - 使用php sdk在facebook中获取访问 token 时出错

我正在使用的代码:$fb=newFacebook\Facebook(['app_id'=>'{app-id}','app_secret'=>'{app-secret}','default_graph_version'=>'v2.6',]);$helper=$fb->getCanvasHelper();try{$accessToken=$helper->getAccessToken();}catch(Facebook\Exceptions\FacebookResponseException$e){//WhenGraphreturnsanerrorecho'Graphreturnedane

php - Symfony2 : Invalid CSRF token while remember me authentication

我有一个用Symfony2.8.11和FosUserBundle2.0.0-beta1编写的应用程序。用户可以通过VPN或基本身份验证连接到站点。他们大多在Windows7上使用InternetExplorer11。他们中的一些人在站点内以随机形式遇到无效的CSRFtoken问题。问题是用户无法提交表单,即使刷新几次页面也是如此。我怀疑是session不断刷新导致的问题,从日志看:{"created":1483610056,"lastUsed":1483610056}["csrf","session_times"][]另外,我怀疑是remembermetoken认证导致的(每个issu

php - 在 yii2 rest 中传递 bearer token 返回 401 错误

我正在使用angular2和yii2restful服务但是它失败了这是我的angular2部分Intheuserserviceconstructor(privatehttp:HttpClientService,private_domaindetails:Domaindetails){}profile(val:string="profile"):Observable{returnthis.http.get(this.getUserUrl(val)).map(this.extractData)}这是httpclientServicecreateAuthorizationHeader(hea

php - 生成 PHP 代码(来自 Parser Tokens)

是否有从ParserTokens中(重新)生成PHP代码的可用解决方案?由token_get_all返回?也欢迎使用其他用于生成PHP代码的解决方案,最好使用相关的词法分析器/解析器(如果有的话)。 最佳答案 来self的评论:Doesanyoneseeapotentialproblem,ifIsimplywritealargeswitchstatementtoconverttokensbacktotheirstringrepresentations(i.e.T_DOto'do'),mapthatoverthetokens,join

php - OAuth 2 中的访问 token 和 auth_codes 有什么区别

我正在使用OAuth2.0PHPLibrary在PHP中开发OAuth2.0服务器。在该库的示例中,我可以看到3个表:auth_codes、clients和tokens。据我所知,token用于访问数据,授权码用于获取token。但问题是如果我这样做...authorize.php?client_id=0123456789ab&response_type=token&state=test_state我什至没有获得访问代码就可以获得token。这怎么可能?这是一个正确的实现吗? 最佳答案 OAuth2有两个流身份验证。双足OAuth三

php regex检测括号内的文本忽略嵌套括号

我正在尝试使php正则表达式工作,该正则表达式解析括号中文本的字符串,同时忽略可能的嵌套括号:假设我想要Loremipsum[1.dolorsitamet,[consectetueradipiscing]elit.].Aeneancommodoligulaegetdolor.[2.Dolor,[consectetueradipiscing]elit.]Aeneanmassa[3.Loremipsum]dolor.返回[1]=>"dolorsitamet,[consectetueradipiscing]elit."[2]=>"Dolor,[consectetueradipiscing]e

php - 如何使用 PHP 生成 Google ReCaptcha V2 安全 token ?

我正在尝试为ReCaptchaV2生成安全token,如下所述:https://developers.google.com/recaptcha/docs/secure_token不幸的是,我生成的stoken无效,我无法找到一种方法来检查它为什么不起作用。有一个有效的Java示例(STokenUtils.java),但我发现自己无法将其翻译成PHP。publicstaticfunctiongenerateSecurityToken($secretKey){$stoken=array('session_id'=>session_id(),'ts_ms'=>round(microtime(

php - PHP 的 Iterator 方法 valid()、current() 和 next() 应该如何运行?

我正在使用来自MAMP的PHP5.3.6.我有一个用例,其中最好使用PHP的Iterator接口(interface)方法、next()、current()和valid()循环访问一个集合。foreach循环在我的特定情况下对我不起作用。一个简化的while循环可能看起来像valid()){//dosomethingwith$iter->current()$iter->next();}当$iter实现PHP的Iterator接口(interface)时,上面的代码是否应该始终有效?PHP的foreach关键字如何处理迭代器?我问的原因是我正在编写的代码可能会被赋予ArrayIterat

php - 将逗号(,)替换为点(.)RegEx php

我正在尝试这段代码,但我得到了这个错误:Noendingdelimiter'/'found$form="2000,50";$salary=preg_replace('/',','.'/',$form);//Noendingdelimiter'/'foundecho$salary;我不确定正则表达式验证。 最佳答案 正则表达式对于仅替换单个字符来说太过分了。为什么不直接这样做呢?str_replace(',','.',$form); 关于php-将逗号(,)替换为点(.)RegExphp,

php - 刷新 oauth2 token google api 和 HWIOAuthBundle

我如何刷新token?我将Googleapi与此token一起使用-它可以工作但找不到如何刷新它,在此示例中我们不保存过期时间。我需要`access_type:offline`然后$client=newGoogle_Client();//$client->setClientId($GoogleClientId);$client->setApplicationName($GoogleAppName);$client->setClientId($this->user->getGoogleId());$client->setAccessType('offline');如果token有效我可以