iconv('utf-8', 'gb2312', $string);还不明白就查看php手册里的详细函数介绍

解决方案 »

  1.   

    Call to undefined function: iconv()
      

  2.   

    <?php
    /**
    * @version $Id: mod_latest_topics_ipb.php,v 1.2 2005/07/25 06:49:01 mamhoo Exp $
    * @package Mamhoo
    * @copyright (C) mamhoo.com
    * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    *//*
    Module desc : Show specific forum's latest topics or all latest topics of IPB 1.3 , 2.0.x . 
    Params:
    count : Topics Count, default value is 5
    addon_tableprefix : IPB Table Prefix, default value is 'ibf_'
    addon_url : IPB Forum URL, use either reletive URL or absolute URL, defaulte value is 'addons/ipb/'
    category_id :  IPB Forum ID,input the forum category id ( table forums' id field ), leave blank will show topics from all forums
    Author: Mamhoo, [email protected]
    Url : http://www.mamhoo.com
    */defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
    $count = intval( $params->get( 'count', 5 ) );
    $ipb_tableprefix = $params->get( 'addon_tableprefix', "ibf_" );
    $ipb_url = $params->get( 'addon_url', "addons/ipb/" );
    $ipb_category_id = $params->get( 'category_id', -1 );$ipb_forums_table = $ipb_tableprefix . "forums";
    $ipb_topic_table = $ipb_tableprefix . "topics";$ids = null;
    if ( $ipb_category_id > -1) {
    // get the forums id of the specific category id
    $query=" SELECT id FROM $ipb_forums_table WHERE parent_id = $ipb_category_id ";
    $database->setQuery($query);
    $ids = $database->loadResultArray();
    if ( !empty( $ids ) ) {
    $ids = implode( ",", $ids );
    }
    }// get the latest topics, limit by $count
    $query = "SELECT tid, title, views FROM $ipb_topic_table ";
    if ( !empty( $ids ) ) {
    $query .= " WHERE forum_id IN ( $ids ) ";
    }
    $query .= " ORDER BY start_date DESC LIMIT 0, $count ";
    $database->setQuery($query);
    $rows =$database->loadObjectList();
    if ( $rows ) {
    // Output
    echo '<ul>';
    foreach( $rows as $row ) {
    $title =  $row->title;
    $tid = $row->tid;
    $topic_url= $ipb_url . "index.php?showtopic=".$tid;
    echo '<li><a href="'.$topic_url.'" target=_blank>' . $title . '</a></li>';
    }
    echo '</ul>';
    }
    ?>
    原来的代码是这样的
    要怎么修改才能转码啊 
    哪位大虾指点一下啊
    我不大熟悉这方面的东西
      

  3.   

    看来是调 $title 然后输出吧你先配置好 iconv 函数吧。不知道你的php版本是多少假如 iconv 函数能用的话 可以这么写$title = iconv('utf-8', 'gb2312', $title);如果  iconv 函数用不了自己写一个 utf8 转 gb2312 的类,或函数。
      

  4.   

    看来你的环境不支持iconv函数,你用的是虚拟空间?还是你自己的服务器?php的版本是多少?
      

  5.   

    是虚拟主机
    PHP版本是4.3.11