草庐IT

strict-origin-when-cross-origin

全部标签

php - X-Frame-Options : does not permit cross-origin framing 拒绝加载

我正在使用laravel4进行我的开发之一,我正在尝试使用跨源调用加载iframe。但它会抛出一个错误,如“X-Frame-Options拒绝加载:不允许跨源框架”。我正在尝试设置标题,例如:header('X-Frame-Options:ALLOW-FROMSAMEORIGIN');header('X-Frame-Options:ALLOW-FROMGOFORIT');但我仍然遇到上述问题。如果我遗漏了什么,请提出建议。 最佳答案 当您使用ALLOW-FROM时您必须指定一个URL,而不是替代值。使用SAMEORIGIN明确阻止跨

php - 可以为库代码而不是我的代码关闭 E_STRICT?

是否可以更改我的PHP应用程序使用include或require_once包含的文件的错误报告级别(关闭E_STRICT)?我希望能够看到我的代码中出现的严格通知,但我使用的是PEARMDB2,当我打开E_STRICT时,我会从该代码中获得警告页面。我知道可以使用.htaccess文件在每个目录的基础上更改error_reporting,但我认为这不适用于包含的文件。我试着把它放在pear文件夹中,但它什么也没做。 最佳答案 你可以defineacustomerrorhandler,并使用$errfile参数来确定错误的来源。如果该

php - 拉维尔 5.2 : How to get the role of current user when using `Zizaco/entrust` ?

我正在使用Laravel5.2和Zizaco/entrust5.2,我的问题是:使用Zizaco/entrust时如何获取当前用户的角色?名称和角色.phpnamespaceApp\Services;useApp\User;useApp\Role;useZizaco\Entrust\EntrustRole;useIlluminate\Support\Facades\Cache;classNameAndRole{public$username;public$role;publicfunction__construct(){$user=\Auth::user();$this->userna

PHP 和 mySQLi : Do I still need to check user input when using prepare statements?

如果我在mySQLi中使用prepare语句,我是否仍然需要以任何方式转义或检查用户输入。例如,如果我有代码:$members=newmysqli("localhost","user","pass","members");$r_email=$_POST['r_email'];$check=$members->prepare("selectuser_idfromuserswhereemail=?");$check->bind_param('s',$r_email);$check->execute();$check->store_result();if($check->num_rows>0

php - 如何从 localhost :8000 to other Ip in laravel when we run "php artisan serve" 更改默认 url

我正在运行phpartisanserve命令默认结果是:Laraveldevelopmentserverstarted:http://127.0.0.1:8000我想改指向其他ip 最佳答案 您可以使用以下解决方案来解决您的问题:phpartisanserve--host127.0.0.1--port80 关于php-如何从localhost:8000tootherIpinlaravelwhenwerun"phpartisanserve"更改默认url,我们在StackOverflow上

PHP session.cookie_secure : Disables sessions when set to true

当我设置以下配置时:ini_set("session.cookie_secure",1);我的整个应用程序的session已禁用,我无法再写入或读取session变量。$sessionName="us";session_name($sessionName);ini_set('session.cookie_httponly',1);ini_set('session.entropy_file','/dev/urandom');ini_set('session.hash_function','whirlpool');ini_set('session.use_only_cookies',1);

php - 代码点火器 2.1.3 : sess_destroy() causes Undefined index: session_id etc notice when 'sess_use_database' == TRUE

我一直在使用数据库测试codeigniter的session功能,每当我注销(使用sess_destroy())时,我都会收到以下通知:APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedindex:session_idFilename:libraries/Session.phpLineNumber:272APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedindex:ip_addressFilename:libraries/Session.phpLineNumber:2

php - fatal error : Class 'ZipArchive' - not found when using PHPUnit

我重构了一些PHP代码并将其放入一系列PHPUnit类中。在其上运行PHPUnit(3.7.28)时(通过控制台)出现上述fatalerror。PHP版本为5.4.6-1ubuntu1.4(cli)。我知道Zip类正在工作并且可用,因为它在正常运行代码时(也通过控制台)工作想法/想法表示赞赏。谢谢!zip=newZipArchive();}} 最佳答案 在命名空间内,您必须使用完全限定的类名来引用类(函数除外)或首先导入它们:$this->zip=new\ZipArchive();或namespacephpUnit\Test;use

php - 警告 : Missing argument 1 when passing parameters from url to controller (laravel)

我正在构建这个网站,我想将url参数传递给路由以及从路由传递给Controller​​,我已经搜索了文档和谷歌,但找不到解决我的问题的方法这是一个示例urllocations/search?q=parameter1我现在的路线是这样的:Route::group(array('prefix'=>'search'),function(){Route::get('locations/{src?}','SearchController@locations',function($src=null){});});我的Controller看起来像这样:classSearchControllerext

php - 什么将 "X-PHP-Originating-Id"添加到我的电子邮件 header ?

我有一个php脚本,可以从托管提供商域通过电子邮件将表单数据发送给我。我无权访问php.ini文件。这个脚本一直运行良好,直到大约一周前电子邮件停止发送-脚本没有错误,只是电子邮件没有离开电子邮件服务器。托管服务提供商声称这是因为属性:“X-PHP-Originating-Id”在我的电子邮件中触发了垃圾邮件过滤器。该属性确实出现在我的header中:Received:(qmail12927invokedbyuid30297);13Jun201319:14:34-0000Received:fromunknown(HELOp3pismtp01-006.prod.phx3.securese