今天由于某篇代码需要修改。没经过测试就上线了,作为多年代码工。出现这种bug太可耻
代码如下:
$a=1;
$b=2;
$t = array(
array('a', 'string', $field['a']), // 名称
if($a==$b){array('b','1')}
);
print_r($t);
exit;
1、由于数组篇幅较长。没注意到
2、开发代码没及时清理缓存。。。。悲剧就是从这里开始
下面是正确的用法
$a==$b?array('sDesc','1'):array('sDesc','2')
代码如下:
$a=1;
$b=2;
$t = array(
array('a', 'string', $field['a']), // 名称
$a==$b?array('b','1'):array('b','2')
);
print_r($t);
exit;
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn