<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>工具箱</title>
<?phprequire_once("../../common/conn.php"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$a_res= array();
$statements = $dbh->prepare("SELECT tool_name,tool_id,tool_pic FROM tb_template_assemble_tools ");
$statements->execute( );
$result = $statements->fetchAll();
foreach ($result as $row)
{
$a_res[]=$row[0];
}
echo $a_res;
$s_res= $a_res.join(',',$a_res);
?> </head>
<body>
<input type="hidden" value="<?php echo $s_res ;?>" name="sst" id="sst"/><script type="text/javascript" language="javascript">
document.write(document.getElementById("sst").value);
</script>
</body>
</html>
输出Array Arrayfff,ssssss,qqqqqqqqqqqq,sssssssssssssssss9
为什么输出的数组第一个元素为Arrayfff 而不是fff;
我的数据库是fff,ssssss,qqqqqqqqqqqq,sssssssssssssssss9
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>工具箱</title>
<?phprequire_once("../../common/conn.php"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$a_res= array();
$statements = $dbh->prepare("SELECT tool_name,tool_id,tool_pic FROM tb_template_assemble_tools ");
$statements->execute( );
$result = $statements->fetchAll();
foreach ($result as $row)
{
$a_res[]=$row[0];
}
echo $a_res;
$s_res= $a_res.join(',',$a_res);
?> </head>
<body>
<input type="hidden" value="<?php echo $s_res ;?>" name="sst" id="sst"/><script type="text/javascript" language="javascript">
document.write(document.getElementById("sst").value);
</script>
</body>
</html>
输出Array Arrayfff,ssssss,qqqqqqqqqqqq,sssssssssssssssss9
为什么输出的数组第一个元素为Arrayfff 而不是fff;
我的数据库是fff,ssssss,qqqqqqqqqqqq,sssssssssssssssss9
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货