如果我想使用PHP非关联数组(如字典)并添加一个大键,那么PHP会分配多少内存?
$myArray = Array();
$myArray[6000] = "string linked to ID 6000";
$myArray[7891] = "another key-value pair";
Run Code Online (Sandbox Code Playgroud)
PHP还会为未使用的密钥0-5999和6001-7890分配内存吗?
我尝试使用Swagger / OpenAPI定义我的AWS Api Gateway基础架构。到目前为止,一切都工作正常,但是我无法在端点上使用API密钥。
我的Swagger文件看起来像这样(缩短):
---
swagger: 2.0
basePath: /dev
info:
title: My API
description: Proof of concept
schemes:
- https
securityDefinitions:
api_key:
type: apiKey
name: X-Api-Key
in: header
paths:
/example-path:
options:
consumes:
- application/json
produces:
- application/json
x-amazon-apigateway-integration:
type: mock
requestTemplates:
application/json: |
{
"statusCode" : 200
}
responses:
"default":
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,HEAD,OPTIONS'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Origin: "'*'"
responseTemplates:
application/json: |
{}
responses:
200:
description: Default response for CORS method
headers:
Access-Control-Allow-Headers:
type: "string"
Access-Control-Allow-Methods:
type: "string" …
Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation swagger aws-api-gateway