注意:数组到字符串的转换PHP3
我收到这个错误: (!)注意:第14行C:\wamp64\www\gcm\ind.php中的数组到字符串转换注意:数组到字符串的转换PHP3,php,Php,我收到这个错误: (!)注意:第14行C:\wamp64\www\gcm\ind.php中的数组到字符串转换 <?php include 'config.php'; include 'db.php'; $com = new DbConnect(); $message=array(); $sql="select UTLR_UID from adm_utilisateurs where UTLR_LOGIN='groom' and UTLR_MDP='groomftw'"; $result=m
<?php
include 'config.php';
include 'db.php';
$com = new DbConnect();
$message=array();
$sql="select UTLR_UID from adm_utilisateurs where UTLR_LOGIN='groom' and UTLR_MDP='groomftw'";
$result=mysqli_query($com->getDb(),$sql);
$getID = mysqli_fetch_assoc($result);
$userID = $getID['UTLR_UID'];
$sqli = "SELECT AHIS_DATEHEURE,AHIS_DES_LN1 FROM alr_historiques WHERE UTLR_UID=$userID ";
$resulti = mysqli_query($com->getDb(),$sqli);
while($row=mysqli_fetch_assoc($resulti))
$message[]=$row['AHIS_DATEHEURE'].$row['AHIS_DES_LN1'];
void echo(字符串$arg1[,字符串$…])
echo
只能输出字符串类型的数据,
或其他可直接转换为字符串
的数据,如布尔
、int
、空
、浮点
我刚刚注意到您使用的是PHP3
,您可以试试这个
foreach($message as $m){
//need to ensure that $m is a string type
echo $m;
}
请参阅更多:
我是stackoverflow的新手,希望能对您有所帮助。$message是一个数组,您不能使用“echo”它。对于调试,查看数组的最佳方法是打印($message)
,或变量转储($message)
尝试更改$message[]=$row['AHIS_DATEHEURE'].$row['AHIS_DES_LN1']代码>至$message.=$row['AHIS_DATEHEURE']。$row['AHIS_DES_LN1']。“
\n”代码>问题是相同的,但我可以看到消息Array2018-04-16helloChange$message=array()代码>至$message=”“代码>啊,可能是其中一个包含,然后,它们计算行数
foreach($message as $m){
//need to ensure that $m is a string type
echo $m;
}