zoukankan      html  css  js  c++  java
  • PHP slim restfull框架nginx 配置

    http://docs.slimframework.com/ 下载地址这个东西很不错,照到官方的例子做

    <?php
    
    require 'vendor/autoload.php';
    
    $app = new SlimSlim();
    $app->get('/hello/:name', function ($name) {
        echo "Hello, $name";
    });
    $app->run();

    访问localhost/index.php/hello/adaaa 怎么都报404错误

    后面想了一下,要支持伪静态.

    Nginx 设置是

    root        /Users/jackluo/Works/php/rest;
    
        location / {
            root    /Users/jackluo/Works/php/rest;
            index   index.html index.php;
            try_files $uri $uri/ /index.php?$args;
        }

    Apache 设置是

    【1】启动mod_rewrite——去掉#,#代表注释
    LoadModule rewrite_module modules/mod_rewrite.so
    
    【2】修改AllowOverride None为AllowOverride All
    #
    # Deny access to the entirety of your server's filesystem. You must
    # explicitly permit access to web content directories in other 
    # <Directory> blocks below.
    #
    <Directory />
        AllowOverride All
        Require all granted
    </Directory>

    这样再访问:

    就有值了

  • 相关阅读:
    LRu Cache算法原理
    c# 哈希表
    c# 获取二维数组的行数和列数
    Linq
    DataTable使用
    Wpf学习
    数据库配置
    js 数字保留两位小树
    平面数据转换为树形结构
    mysql操作
  • 原文地址:https://www.cnblogs.com/jackluo/p/3737924.html
Copyright © 2011-2022 走看看