求教php如何创建一个带键名的空数组,后期再赋值 php数组 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先你创建数组的格式就不对.$strkeys= ['tagname'=>'', 'descr'=>'','unit'=>''];$days=30;for($w= 1; $w<= $days; $w++){ $strkeys[$w.'日']='';}$strkeys['Total']='';print_r($strkeys); [] 格式是PHP 5.4 及以上版本才有的数组简写格式 $strkeys= array('tagname'=>'','descr'=>'','unit'=>'');$days = 31;for($w= 1; $w<= $days; $w++){ $strkeys[$w.'日'] = '';}$strkeys['Total'] = '';$excelres[]= $strkeys;print_r($excelres);Array( [0] => Array ( [tagname] => [descr] => [unit] => [1日] => [2日] => [3日] => [4日] => [5日] => [6日] => [7日] => [8日] => [9日] => [10日] => [11日] => [12日] => [13日] => [14日] => [15日] => [16日] => [17日] => [18日] => [19日] => [20日] => [21日] => [22日] => [23日] => [24日] => [25日] => [26日] => [27日] => [28日] => [29日] => [30日] => [31日] => [Total] => )) php生成xml小问题一个,不懂,在线等! 怎么判断一个checkbox已选? 着急啊上火啊 那位大哥帮卡下 WAMP启动不了 URL解析,加载对应的类与方法的大小写问题 php写xml, 赋值由数组怎么弄 PHPWind出售贴如何统一换成交易币 自定义404的问题 请教大虾:开发大型网上商城的话,用什么数据库最好? 在线等一个答案! 如何把一条printf语句分两行写? Smarty的一个问题 新手请教Ajax传多个值给php的问题
'descr'=>'','unit'=>''
];
$days=30;
for($w= 1; $w<= $days; $w++)
{
$strkeys[$w.'日']='';
}
$strkeys['Total']='';
print_r($strkeys);
$strkeys= array('tagname'=>'','descr'=>'','unit'=>'');
$days = 31;
for($w= 1; $w<= $days; $w++)
{
$strkeys[$w.'日'] = '';
}
$strkeys['Total'] = '';
$excelres[]= $strkeys;print_r($excelres);Array
(
[0] => Array
(
[tagname] =>
[descr] =>
[unit] =>
[1日] =>
[2日] =>
[3日] =>
[4日] =>
[5日] =>
[6日] =>
[7日] =>
[8日] =>
[9日] =>
[10日] =>
[11日] =>
[12日] =>
[13日] =>
[14日] =>
[15日] =>
[16日] =>
[17日] =>
[18日] =>
[19日] =>
[20日] =>
[21日] =>
[22日] =>
[23日] =>
[24日] =>
[25日] =>
[26日] =>
[27日] =>
[28日] =>
[29日] =>
[30日] =>
[31日] =>
[Total] =>
))