ARCates::getChildOptionStr PHP Method

getChildOptionStr() public static method

获取子分类的下拉选项
public static getChildOptionStr ( type $pid, type $level ) : type
$pid type
$level type
return type
    public static function getChildOptionStr($pid, $level)
    {
        $optionStr = CHtml::tag('option', array('value' => ''), '请选择');
        $cates = self::getCates($pid, $level);
        if (!empty($cates)) {
            foreach ($cates as $id => $name) {
                $optionStr .= CHtml::tag('option', array('value' => $id), $name);
            }
        }
        return $optionStr;
    }

Usage Example

コード例 #1
0
ファイル: AjaxController.php プロジェクト: jackycgq/advanced
 public function actionCate()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $pid = Yii::app()->request->getParam('pid');
         $level = Yii::app()->request->getParam('level');
         echo ARCates::getChildOptionStr($pid, $level);
     }
 }