Skip to content

Commit

Permalink
修改配置文件错误,添加组件说明
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasgoog committed Aug 8, 2017
1 parent be3e72b commit 1bb2a72
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# aycors
thinkphp5 for cors

## 安装方法

### 第一步 使用composer下载SDK

```bash
composer require ayteam/aycors
```

### 第二步 项目根目录执行

```bash
php think cors:config
```

> 查看application/extra/cors.php这个文件是否存在,
如果不存在复制一份 [config.php](https://github.com/ayteam/aycors/blob/master/src/config.php)
到 application/extra

## 使用方法
具体参考 [跨域资源共享 CORS 详解](http://www.ruanyifeng.com/blog/2016/04/cors.html)

```php
return Cors::json(['code'=>1]);
```
如果有不懂的,可以下面评论。
也欢迎大家在github提交issue和PR
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"keywords": [
"thinkphp5",
"cors",
"Access-Control-Allow-Origin"
"Cross-origin resource sharing"
],
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/command/SendConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function configure()
public function execute(Input $input, Output $output)
{
//获取默认配置文件
$content = file_get_contents(VENDOR_PATH .'aycors/tp-cors/src/config.php');
$content = file_get_contents(VENDOR_PATH .'ayteam/aycors/src/config.php');
$configPath = CONF_PATH.'extra/';
$configFile = $configPath.'cors.php';
//判断目录是否存在
Expand Down
2 changes: 1 addition & 1 deletion src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| to accept any value.
|
*/
'supportsCredentials' => false,
'supportsCredentials' => true,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['*'],
'allowedMethods' => ['*'],
Expand Down

0 comments on commit 1bb2a72

Please sign in to comment.