我正在尝试在数组中使用for循环,但是它不起作用
$color = [
'Apple' => [
'Red',
'Green',
],
'Mange' => [
'Red',
'Green',
],
'Orange' => [
'Red',
'Orange',
],
];
$taste = [
'Red' => [
'Slicy'
],
// so on...
];
有人可以帮助我吗?
答案 0 :(得分:0)
这里肯定有一些语法问题,因为数组声明内不能有for循环,而// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
#region Custom Code Added Here
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters();
//Override the JWT Events
options.Events = new JwtBearerEvents()
{
OnChallenge = context =>
{
//custom logic goes here. At the end of your logic make sure that you
//"Handle" the response by calling HandleResponse, and return a 0.
context.HandleResponse();
return Task.FromResult(0);
}
};
});
#endregion
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
内什么也没做。
您可能想要实现的目标有几种可能性:
第一,不太可能:
'moon'=>$i
第二个合理的猜测:
$data=array();
for ($i=0;$i<$get_row_in_book;$i++){
$data['moon'] = $i;
}
// overwrites 'moon' with the last value (assuming $get_row_in_book=6)
// OUTPUT
$data = ['moon' => 5];