$str = 'abcdef abcdef';
echo substr($newstring,0,strpos($str, ' '));

解决方案 »

  1.   


    $str = 'abcdef abcdef';
    echo substr($str,0,strpos($str, ' '));
      

  2.   

    <?php
      if(!isset($page)) $page=1;  
      if($page==0) $page=1;
      if((int)$page > $MaxPage)  
        $page=$MaxPage; 

      if(mysql_data_seek($result,($page-1)*$pageSize)) 
      {   
        //循环显示当前纪录集
        for($i=0;$i<$pageSize;$i++)
      { 
      $arr=mysql_fetch_array($result);
      $title=$arr["TITLE"];
      if(!$arr)continue;  //$arr为空的时候不输出任何东西
    ?>
    <tr><td height="25"><span class="style5"> ·</span>
    <a href=NEWS_INFO.php?title=<?php echo "$title";?> target="blank">
    <span class="style14">
    <?php echo "{$arr['TITLE']}"."{$arr['UPLOADTIME']}";?> </span>
    </a>
    </td></tr>
    <?php
    }

    ?>
    <?php 
                    //首页和上一页的链接 
                    if($page>1)  
                    {  
                      $prevPage=$page-1;  
                      echo " <a href={$_SERVERS['PHP_SELF']}?page=1>首页</a> ";  
                      echo " <a href={$_SERVERS['PHP_SELF']}?page=$prevPage >上一页</a> "; 
                    } 
      ?>
    <?php 
    if($page<$MaxPage)  //未页和下一页
                {  
                   $nextPage= $page+1; 
                   echo " <a href={$_SERVERS['PHP_SELF']}?page=$nextPage >下一页</a> ";  
                   echo " <a href={$_SERVERS['PHP_SELF']}?page=$MaxPage >末页</a> ";  
                 }  
                 ?>  
    这是我这个翻页的完整代码,不知那里有错、大家帮我找找
      

  3.   

    <a href=NEWS_INFO.php?title=<?php echo "$title";?> target="blank">
    $tilte 里面有空格所以要用引号引起来 <a href=NEWS_INFO.php?title="<?php echo "$title";?>" target="blank">
    这样就OK了