<?php
/**
     * 自动分类 根据关键字
     */
    public function fenlei(){
        $arr = array();
        $arr[1] = array("钱包","卡包","方包");
        $arr[2] = array("包包","双肩包","单肩包","斜挎包","行李");
        $arr[3] = array("皮带","腰带");
        $arr[4] = array("外套","西服","衣服","服装","短袖");
        $arr[5] = array("鞋");
        $arr[6] = array("眼镜","围巾","帽","手套","项链","香水","口红");
        $arr[7] = array("表");

        $result = array();
        // 将每个都以%分割
        foreach ($arr&nbsp;as&nbsp;$k=> $vo){
            foreach ($vo&nbsp;as&nbsp;$k2=>$vo2){
                $str ="%";
                for($i&nbsp;=&nbsp;0;&nbsp;$i<mb_strlen($vo2);$i++){
                    $str&nbsp;&nbsp;.=&nbsp;mb_substr($vo2,0+$i,1,'utf-8') . "%";
            }
            $result[$k][$k2]&nbsp;=&nbsp;$str;
            }
        }
        dump($result);
    }
?>
最后修改:2018 年 10 月 23 日 04 : 34 PM
如果觉得我的文章对你有帮助,请随意赞赏