草庐IT

from_user

全部标签

php - Symfony 2 功能测试 : authenticate user of own User class

如HowtouseanauthenticateduserinaSymfony2functionaltest?的回答中所述Symfony\Component\Security\Core\User\User有一个简单的解决方案。但是我有不同的用户类(一些必要的附加字段),我想用它来验证用户。我如何为它设置供应商? 最佳答案 这里讨论的是一个棘手的问题:https://github.com/symfony/symfony/issues/5228虽然它是2.1,但我使用2.2时仍然会发生这种情况。下面是我如何进行测试认证://Createa

php - 为什么我从 SagePay 收到错误 "4020 : Information received from an Invalid IP address."?

这是一个PHP(ZendFramework1.11)站点,未使用现成的软件包。当请求到:https://live.sagepay.com/gateway/service/vspserver-register.vsp(使用PAYMENT的TxType),我得到以下响应:4020:InformationreceivedfromanInvalidIPaddress.我已登录到SagePay管理区域并将实时服务器的IP地址添加到有效IP部分,我已确保它使用正确的SagePayURL发布到和。需要注意的是,这个问题是今天早上开始的,当时我们通过更改Vendor属性更改了接收付款的SagePay帐

php - 恐惧超时与 'mod_fcgid: read timeout from pipe'

我的应用程序尝试访问超时的URL有问题。我正在trycatch此超时并使用以下代码解决此问题:$timeout=120;if(false==$handle=@fsockopen($host,$port,$errno,$errstr,$timeout)){thrownewException("Couldnotconnecttourl:".$errstr);}$getRequest="GET{$url}HTTP/1.0\r\n";$getRequest.="Host:{$urlParts['host']}\r\n";$getRequest.="Connection:close\r\n\r\

php - ' fatal error : Class 'CURLFile' not found' error in Facebook PHP Application for 'upload photo to user' s timeline'

我刚刚尝试使用FacebookPHPSDK开发一个Facebook应用程序。Facebook开发者网站中给出的示例代码如下。'YOUR_APP_ID','secret'=>'YOUR_APP_SECRET','fileUpload'=>true,'allowSignedRequest'=>false//optionalbutshouldbesettofalsefornon-canvasapps);$facebook=newFacebook($config);$user_id=$facebook->getUser();$photo='./mypic.png';//Pathtothepho

PHP : Show the headers received from the browser

因此,当浏览器向服务器发出HTTP请求时,它采用一些header(get/post、cookies、host、UserAgent等)的形式。有没有一种方法可以在php脚本中读取和显示它们?是的,$_GET、$_POST和$_COOKIE都在那里。我正在寻找其余的标题信息。例如http://pgl.yoyo.org/http/browser-headers.php谢谢。 最佳答案 get_headers()功能是你要找的。如引用get_headers—Fetchesalltheheaderssentbytheserverinrespo

php - 如何在单元测试(PHPUnit)中的 trigger_error(..., E_USER_WARNING) 之后执行代码?

我有这样的代码:classToBeTested{functionsimpleMethod($param){if(0===$param){trigger_error("Paramis0!",E_USER_WARNING);returnfalse;}returntrue;}}并测试这段代码:classSimpleTestextendsPHPUnit_Framework_TestCase{functiontestSimpleMethod(){$toBeTestedObject=newToBeTested();$this->assertFalse($toBeTestedObject->simp

php - Laravel 5.2 -> 5.3 Auth::user() 返回 null

我已经从5.2升级到5.3,Auth::user()返回null。路线Route::group(['middleware'=>['auth']],function(){Route::get('/test','MyController@showMain');}Controller构造函数调用Auth::check()返回nullpublic$user;publicfunction__construct(){$this->user=Auth::user();}publicfunctionshowMain(){return$this->user;}ControllershowMain调用Au

PHP/Zend : How to remove all chars from a string and keep only numbers

我只想保留数字并从变量中删除所有字符。例如:input:+012-(34).56.(ASD)+:"{}|78*9output:0123456789 最佳答案 这是一般的做法:$numbers=preg_replace('/[^0-9]+/','','+012-(34).56.(ASD)+:"{}|78*9');echo$numbers;输出:0123456789 关于PHP/Zend:Howtoremoveallcharsfromastringandkeeponlynumbers,我们在

php - Symfony2 表单集合 : How to remove entity from a collection?

我尝试从集合中删除实体,但它不起作用。我想我在某处有错误,但我不知道在哪里。这是我的updateAction中的代码:$em=$this->getDoctrine()->getEntityManager();$entity=newPerson();if(!$entity){throw$this->createNotFoundException('UnabletofindPersonentity.');}$editForm=$this->createForm(newPersonType(),$entity);$deleteForm=$this->createDeleteForm($id)

php - laravel 护照 : Request user() returning null outside auth:api middleware, 和内部返回用户对象

当我尝试使用auth:api中间件获取登录用户的详细信息时,它会在我的Controller函数中返回包含详细信息的用户对象。api.php(withauth:apimiddlewarereturnsUserobject)Route::group(['middleware'=>'auth:api'],function(){Route::get('users/mentor_details/{uuid}','UserController@getMentorProfileDetails');});但是当我试图在这个auth:api中间件之外获取登录用户详细信息时,它返回null。api.php