小编Chr*_*ser的帖子

Laravel Restfull控制器和路由ajax/sync请求

我正在寻找使用普通表单将ajax请求作为同步请求处理的最有效方法.据我所知,有两种方法可以处理例如新的订单发布请求:

选项1:AJAX检查控制器(为简单起见,验证并省略).

//Check if we are handling an ajax call. If it is an ajax call: return response
//If it's a sync request redirect back to the overview
if (Request::ajax()) {
    return json_encode($order);
} elseif ($order) {
    return Redirect::to('orders/overview');
} else {
    return Redirect::to('orders/new')->with_input()->with_errors($validation);
} 
Run Code Online (Sandbox Code Playgroud)

在上面的例子中,我必须在每个控制器中进行检查.第二种情况解决了这个问题,但对我来说这看起来有些过分.

选项2:让路由器根据请求处理请求检查和asign控制器.

//Assign a special restful AJAX controller to handle ajax request send by (for example) Backbone. The AJAX controllers always show JSON and the normal controllers always redirect like in the old days. …
Run Code Online (Sandbox Code Playgroud)

php rest laravel

5
推荐指数
1
解决办法
2805
查看次数

Fedora文件权限apache没有写访问权限

我花了几个小时来找到如何在Fedora 18中获取apache安装的文件权限.我做了以下没有任何运气:

httpd.conf(之后重启)

DocumentRoot "/var/www/html"

<Directory "/var/www/html/">
    AllowOverride all
    # Allow open access:
    Require all granted
    Options Indexes FollowSymLinks Multiviews
</Directory>
Run Code Online (Sandbox Code Playgroud)

我的/ var/www/html文件夹上的文件权限

drwxrwxrwx. 6 chris apache 4096 26 apr 22:40 .
drwxrwsrwx. 7 chris apache 4096 23 apr 09:30 ..
-rwxrwxrwx. 1 chris apache   19 22 apr 08:37 index.php
-rwxrwxrwx. 1 chris apache   20 21 apr 17:14 info.php
drwxrwxrwx. 8 chris apache 4096 27 apr 14:58 pyro
-rwxrwxrwx. 1 chris apache  125 24 apr 00:36 test.html
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我甚至递归地将权限更改为777(使用-R)

我还尝试将用户更改为root和apache,group to …

apache permissions fedora chmod chown

1
推荐指数
1
解决办法
6374
查看次数

标签 统计

apache ×1

chmod ×1

chown ×1

fedora ×1

laravel ×1

permissions ×1

php ×1

rest ×1