我输入一个字符,和2个数字调用这个函数,结果老是0,不知哪里有错,望指正,谢谢function toRightString($string,$totalLength,$cnLength)//$totalLength总共显示的字符长度,$cnLength文字字符长度
{
$point=1;
if(!($cnLength%2==0))$cnLength++;
$strLength=strlen($string);
if($cnLength<=$strLength)
{
$string=substr($string,0,$cnLength);
for($point;$point<=($totalLength-$cnLength);$point++)
{
$string+=".";
}
}else{
for($point;$point<=($totalLength-$strLength);$point++)
{
$string+=".";
}
}
return $string;
}
{
$point=1;
if(!($cnLength%2==0))$cnLength++;
$strLength=strlen($string);
if($cnLength<=$strLength)
{
$string=substr($string,0,$cnLength);
for($point;$point<=($totalLength-$cnLength);$point++)
{
$string+=".";
}
}else{
for($point;$point<=($totalLength-$strLength);$point++)
{
$string+=".";
}
}
return $string;
}
function toRightString($string,$totalLength,$cnLength)//$totalLength总共显示的字符长度,$cnLength文字字符长度
{
$point=1;
if(!($cnLength%2==0))$cnLength++;
$strLength=strlen($string);
if($cnLength<=$strLength)
{
$string=substr($string,0,$cnLength);
for($point;$point<=($totalLength-$cnLength);$point++)
{
$string+=".";
}
}else{
for($point;$point<=($totalLength-$strLength);$point++)
{
$string+=".";
}
}
return $string;
}
echo toRightString("r","1","1");//r
?>
例如:
toRightString('r',2,1);
就会返回0toRightString('rb',2,1);
就不会
sdasfds......,就是只显示字符串的其中一段,后面加上省略号的效果
国内超强ORM类http://code.google.com/p/queryphp/downloads/list
习惯了c的语法了,乱套了