在PHP里我改了不行,请高手能否详细说明,谢谢!

解决方案 »

  1.   

    你$file_name的值是从哪里来的啊?先看看html页面的文字编码是什么,通常是gb2312或者utf-8,如果是从数据库来的话还要看该字符串在数据库里的编码,特别是mysql 4.1 之后的,没弄好很容易乱码。
      

  2.   

    程式代码(全部)
    <?
    header("Content-type: text/vnd.wap.wml"); 
    echo "<?xml version=\"1.0\"?>"; 
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; 
    $page = $_GET['page'];
    include("../config.php");
    if (!isset($page)) {$page = 0;}
    $total = 0;if(!($dp = opendir("./"))) die ("不能打开网页 ./");
    $file_array = array(); 
    while ($file = readdir ($dp))
    {
    if(substr($file,0,1) != '.' and $file != "index.php")
    {
    $file_array[] =  $file;
    }
    }
    $file_count = count ($file_array);
    sort ($file_array);
    ?> 
    <wml> 
    <card id="card1" title="<? echo $conf["site_name"] ?>"> 
    <p mode="nowrap">
    <? echo "<a href=\"../index.php\">首页</a><br/><br/>"; ?>
    <?

    if ($file_count > 0)
    {
    $first_record = $page * $conf["items_per_page"];
    $last_record = $first_record + $conf["items_per_page"];

    while (list($fileIndexValue, $file_name) = each ($file_array))
    {

    if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
    {

    echo "<a href=\"$file_name\">$file_name</a> (". round(filesize($file_name)/1024,1) . "kb)<br/>";
    $total = $total + filesize($file_name);
    }
    }


    if (($file_count > 0) AND ($last_record < $file_count))
    {
    // next button
    $next_page = $page + 1;
    echo "<br/><a href=\"".$_SERVER['PHP_SELF']."?page=$next_page\">下一页</a><br/>";
    }


    if (($file_count > 0) AND ($page != 0))
    {
    // previous button
    $prev_page = $page -1;
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev_page\">上一页</a><br/>";
    }



    echo "<br/>目录:<br/>$file_count ";
    if ($file_count == 1)
    {echo "文件";}
    else
    {echo "文件";}

    echo " (" . round($total/1024,1) . "kb)";
    echo "<br/><a href=\"../index.php\">首页</a>";
    }
    closedir($dp);
    ?>

    </p>
    </card> 
    </wml> 
      

  3.   

    能看到中文文件列表,但是点中文文件点开或下载时所显示的URL是中文编码(不是中文字),打不开对应的中文名文件,
      

  4.   

    urldecode怎么用在这个程式中,web_php能否说得详细点?
      

  5.   

    echo "<?xml version=\"1.0\" ecnoding=\"UTF-8\"?>"; 
    另一方面如果可以,还是把你的当前页面另存为"UTF-8"格式;
      

  6.   

    还与你的操作系统有关系。如果是在LINUX下运行,中文就不可以了。
      

  7.   

    啊,我是freeBSD UNIX系统,那是没治了?????