代码结果不显示

littlebirds 2010-07-27 03:34:57

$change = array('S624W81D' => 'S624W8U6',
'T624W81D' => 'T624W8U6',
'S624XF1D' => 'S624XFU6',
'T624XF1D' => 'T624XFU6',
'X624W81D' => 'X624W8U6',
'X624XF1D' => 'X624XFU6',
'S624W41D' => 'S624W4U6',
'T624W41D' => 'T624W4U6',
'X624W41D' => 'X624W4U6',
'S534W81D' => 'S534W8U6',
'T534W81D' => 'T534W8U6',
'X534W81D' => 'X534W8U6'
);
$col = explode(" ",trim($myfile[4])); if(($col[3]=='S624W81D')||($col[3]=='T624W81D')||($col[3]=='S624XF1D')||($col[3]=='T624XF1D')||($col[3]=='X624W81D')||
($col[3]=='X624XF1D')||($col[3]=='S624W41D')||($col[3]=='T624W41D')||($col[3]=='X624W41D')||($col[3]=='S534W81D')||
($col[3]=='T534W81D')||($col[3]=='X534W81D'))
{
$pgm = $col[3];
}
else
{
$pgm = $change[$col[3]];
}
$pgm_version = $col[6];
echo $pgm.'<br />';
echo $pgm_version.'<br />';


现在$pgm的结果不显示,请问是什么原因?
...全文
48 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
littlebirds 2010-07-27
[Quote=引用 4 楼 dingsongtao 的回复:]

对比下你的数据。
$col[3]的值是H524W8U6
那你的程序会有值吗??
[/Quote]
这个我知道了。我想问下,象这样:
'S624W81D' => 'S624W8U6'
'T624W81D' => 'T624W8U6'
'S624XF1D' => 'S624XFU6'
'T624XF1D' => 'T624XFU6'
'X624W81D' => 'X624W8U6'
'X624XF1D' => 'X624XFU6'
'S624W41D' => 'S624W4U6'
'T624W41D' => 'T624W4U6'
'X624W41D' => 'X624W4U6'
'S534W81D' => 'S534W8U6'
'T534W81D' => 'T534W8U6'
'X534W81D' => 'X534W8U6'

有没有办法让xxxxU6替换xxxx1D?就像H524W81D 结果把它变成H524W8U6.
回复
CunningBoy 2010-07-27
str_replace('1D', 'U6', $string);
回复
Dleno 2010-07-27
对比下你的数据。
$col[3]的值是H524W8U6
那你的程序会有值吗??
回复
littlebirds 2010-07-27
有没有办法让xxxxU6替换xxxx1D?就像H524W81D 结果把它变成H524W8U6.
回复
littlebirds 2010-07-27
** PROGRAM : H524W8U6 REV. G.01B DEVICE TYPE : MICRON DDR2
回复
Dleno 2010-07-27
$myfile[4]里是什么???
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告