显示内容的一部分怎么写啊? php无left函数,要用substr函数echo ' '.substr($content,0,200).chr(0); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <? @db_connect();$query = "select * from instructor where lx='$tempid'";$result = @mysql_query($query, $GLOBALS['db_handle']);$i=0;while($row = @mysql_fetch_array($result)){ if($i>20) break; if (($i % 2) == 0) { $bg_color = "#F3F3F3"; } else { $bg_color = "#ffffff"; } ?> <table border="0" cellpadding="0" cellspacing="0" align="center" width="100%"> <tr bgcolor=<?=$bg_color?>> <td height="4"> <?echo '<img src="/images/ball.gif" width="7" height="6" type=square> <a href="javascript:nav(\'note.php?topid='.$row['id'].'\',0,0,0)" >'.$row['title'].'</a>';?> </td> </tr> <tr bgcolor=<?=$bg_color?>> <td height="4"> <? echo '.substr('.$row['content'].',0,200).chr(0)'; ?> </td> </tr> </table> <?$i++; }?> 唠叨的方法是最简单的。<?echo substr("abcdef", 1, 3); // 传回 "bcd"echo substr("abcdef", -2); // 传回 "ef"echo substr("abcdef", -3, 1); // 传回 "d"echo substr("abcdef", 1, -1); // 传回 "bcde"?> 对了,你ECHO $content试试,变量过去了吗。别折腾半天,根本没搞上 echo '.substr('.$row['content'].',0,200).chr(0)';我是这样写的,可显示的是全部的内容啊! echo substr($row['content'],0,200).chr(0); 请问htaccess的规则怎么转成httpd.ini的规则 引用php文件的路径定向问题 Message: array_push() expects parameter 1 to be array, null given 审核功能逻辑怎么走?如果想随时控制审核呢? 求一个正则替换 数据筛选 大家好,为什么我的程序显示乱麻呢?? 是日文的编码 这个东西怎么做出来? PHP新手,求教大神!! 一个购物车删除的问题! setcookie用不好,各位幫忙. php连接access数据库的问题,郁闷~~
@db_connect();$query = "select * from instructor where lx='$tempid'";$result = @mysql_query($query, $GLOBALS['db_handle']);
$i=0;
while($row = @mysql_fetch_array($result)){ if($i>20) break;
if (($i % 2) == 0)
{
$bg_color = "#F3F3F3";
}
else
{
$bg_color = "#ffffff";
}
?>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%">
<tr bgcolor=<?=$bg_color?>>
<td height="4">
<?echo '<img src="/images/ball.gif" width="7" height="6" type=square> <a href="javascript:nav(\'note.php?topid='.$row['id'].'\',0,0,0)" >'.$row['title'].'</a>';?>
</td>
</tr>
<tr bgcolor=<?=$bg_color?>>
<td height="4">
<?
echo '.substr('.$row['content'].',0,200).chr(0)';
?>
</td>
</tr>
</table>
<?$i++;
}
?>
<?
echo substr("abcdef", 1, 3); // 传回 "bcd"
echo substr("abcdef", -2); // 传回 "ef"
echo substr("abcdef", -3, 1); // 传回 "d"
echo substr("abcdef", 1, -1); // 传回 "bcde"
?> 对了,你ECHO $content试试,变量过去了吗。别折腾半天,根本没搞上
我是这样写的,可显示的是全部的内容啊!