我正在开发一个angularjs应用程序,它使用laravel作为其后端服务器.我在每次GET请求之前从laravel访问数据时遇到问题,angular首先发送OPTION请求,如下所示
OPTIONS /61028/index.php/api/categories HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Access-Control-Request-Method: GET
Origin: http://localhost:3501
Access-Control-Request-Headers: origin, x-requested-with, accept
Accept: */*
Referer: http://localhost:3501/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: UTF-8,*;q=0.5
Run Code Online (Sandbox Code Playgroud)
我试图通过在前过滤器中添加以下代码来回应这个问题
if (Request::getMethod() == "OPTIONS") {
$headers = array(
'Access-Control-Allow-Origin' =>' *',
'Access-Control-Allow-Methods'=>' POST, GET, OPTIONS, PUT, DELETE',
'Access-Control-Allow-Headers'=>'X-Requested-With, content-type',);
return Response::make('', 200, $headers);
}
Run Code Online (Sandbox Code Playgroud)
这会使用标题创建响应
Content-Encoding: gzip
X-Powered-By: PHP/5.3.5-1ubuntu7.11
Connection: Keep-Alive
Content-Length: 20
Keep-Alive: timeout=15, max=97
Server: Apache/2.2.17 (Ubuntu)
Vary: Accept-Encoding
access-control-allow-methods: POST, GET, OPTIONS, PUT, DELETE
Content-Type: text/html; charset=UTF-8
access-control-allow-origin: …Run Code Online (Sandbox Code Playgroud) 我已经读过很多人在浏览器中没有加载真正的斜体字体样式的问题,我另外想要强制浏览器使用Faux Italic.这是我的css代码:
h2 {
font-family:"Bell MT", Georgia, serif;
font-size:31px;
font-style:oblique;
font-weight:normal;
color:#e19614;
}
Run Code Online (Sandbox Code Playgroud)
当我将font-weight设置为粗体或更大时,产生的效果是所需的倾斜字体,但每当我将重量设置为正常(这是所需的设置)时,它会回到真正的斜体字体,在这种情况下(Bell MT)是非常不同的..
有什么建议?
我有一个表书:带有ID(int)和ISBN(字符串)ISBN是唯一的密钥.我有另一张桌子,我把书中的isbn存储起来.在书模型上我有:$ this-> hasMany('Other','isbn','isbn');
但这忽视了伊斯本.你知道这样做的方法吗?
临时修复:
$this->primaryKey = 'isbn';
return $this->hasMany('Other', 'isbn');
Run Code Online (Sandbox Code Playgroud)