我在互联网上找到的所有数据都是关于CakePHP V2的.在V3中,我无法使用cakePHP 3配置MongoDB.我不知道如何为mongoDB配置数据源.我的默认数据库配置如下:
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'users',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
]
]
Run Code Online (Sandbox Code Playgroud) 我有和的NodeJS Nginx的运行我是API“API_KEY”在增派头及其在没有收到req.headers并req.get('api_key')在我的NodeJS有nginx的波纹管配置文件
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name mysite.com;
return 301 https://$host$request_uri;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:9102/;
proxy_set_header Host $http_host;
proxy_set_header api_key $http_api_key;
#proxy_set_header api_key 'Some Value'; works
proxy_redirect off;
}
}
Run Code Online (Sandbox Code Playgroud)
如果设置proxy_set_header api_key 'some value'它的值有效并且标题打印在控制台上但api_key会发生变化,这就是我使用的原因,$http_api_key以便api_key自定义标题中的任何内容在从其余客户端发送时被接收。我已经尝试了几个解决方案,proxy_set_header api_key $upstream_http_api_key;但没有帮助。我想接收从 nodejs 中的休息客户端发送的任何自定义标头。
reverse-proxy nginx http-headers node.js nginx-reverse-proxy
我正在使用cakephp 3迁移插件来设计数据库.我想添加一个status字段tinyint限制1的字段,我尝试了以下但没有添加任何内容.
尝试1.(失败)
$table->addColumn('status', 'smallinteger', [
'default' => 0,
'limit' => 1,
'null' => false,
]);
Run Code Online (Sandbox Code Playgroud)
尝试2.(失败)
$table->addColumn('status', 'tinyint', [
'default' => 0,
'limit' => 1,
'null' => false,
]);
Run Code Online (Sandbox Code Playgroud)
我找不到任何相同的文档可能是它在那里,我错过了Docs链接