davidhhuan

davidhhuan

blog: <a href="http://cnblogs.com/davidhhuan" target="_blank">http://cnblogs.com/davidhhuan</a><br /> site: <a href="http://www.jiule.org" target="_blank">http://www.jiule.org</a>

  • 财富值265
  • 威望值10
  • 总积分365

个人信息

  • <?php
    return array(
        'urlFormat'=>'path',
        'urlSuffix'=>'.html',
        'showScriptName'=>false,
        'caseSensitive'=>false,
        'rules'=>array(
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    );
    

    [/code]还是不明白你想这样做的目的是什么.

    其它参数放在query里面? 即使是 /controllerId/actionID/id/123.html, 你也可以直接用$_GET['id']取出来的

  • <?php
    return array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'caseSensitive'=>false,
        'rules'=>array(
            '<controller:\w+>/<action:\w+>.html?id=<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    );
    

    你想要的格式.
    不过这样的格式貌似用处不是很大,既不是友好的url,又不是一般的格式.

  • 你在layout里面的content之前有没有其它输出?

  • 说得比较笼统啊。。。

    你这样说,我只能叫你用firebug调试 了。。。

  • 没玩过TP,不知道它是怎么调用views的。

    在yii里面,你的controller对应在views里面有一个文件夹,你的对应的视图文件放在里面,然后在action里面调用$this->render('views_name'),详细请参考blog demo

  • 你是说使用views吗?

  • /**
         * cut the string with utf8 or gbk
         *
         * @author davidhhuan
         * @param string $string: the string you want to handle with
         * @param int $start
         * @param int $end
         * @param int $length: how long of the string you want
         * @param string $append: The end of the output string
         * @return string
    */
    public function substr($string, $start = 0, $length = 0, $append = '...')
    {
        $string = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;'), array('&', '"', '<', '>'), $string); 	
        $stringLast = "";
        if ($start < 0 || $length < 0 || strlen($string) <= $length)
        {
            $stringLast = $string;
        }
        elseif (file_exists('mb_substr'))
        {
            $stringLast = mb_substr($string, $start, $length);
        }
        else
        {
            $i = 0;
            while ($i < $length)
            {
                $stringTMP = substr($string, $i, 1);
                if ( ord($stringTMP) >=224 )
                {
                    $stringTMP = substr($string, $i, 3);
                    $i = $i + 3;
                }
                elseif( ord($stringTMP) >=192 )
                {
                    $stringTMP = substr($string, $i, 2);
                    $i = $i + 2;
                }
                else
                {
                    $i = $i + 1;
                }
                $stringLast[] = $stringTMP;
            }
            $stringLast = implode("",$stringLast);
                
    }
            
    $stringLast = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $stringLast);
    
    if(!empty($append))
    {
        $stringLast .= $append;
    }
            
    return $stringLast;
    }
    
  • 你两个div都调成float: left就可以了

  • 基本上没什么影响,如果你只用mysql的话~而且你这些函数都通用

  • 这个不关yii的事吧,数据库查询问题。。。

    我只想到一个笨方法:
    既然你是用时间戳,那么就可以设定一个范围咯,

    比如说,你要搜9月内的,那么,create_time > 12000000 AND create_time <130000000 (数字只是举例)

见习主管 等级规则
365/500
资料完整度
60/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

0

Ta的访客

4