分类 php 下的文章

 function http_request($url, $data = null)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);

        if (!empty($data)) {
            curl_setopt($curl, CURLOPT_POST, TRUE);
            curl_setopt($curl, CURLOPT_POSTFIELDS,$data);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json'
            ));
        }
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
        $output = curl_exec($curl);
        curl_close($curl);
        return $output;
        exit();

    }
  function stock(){
       if($_POST){
       $code =  $this->frparam('code',1,'603906');
       $url = "http://yunhq.sse.com.cn:32041//v1/sh1/snap/".$code;
       $info = $this->http_request($url);
      // JsonReturn(['code'=>1,'msg'=>$info]);   
       if(strpos($info,'nginx')){
         JsonReturn(['code'=>1,'msg'=>'code Error!']);  
       }else{
       $info = json_decode($info);
       $dt = $info->date;
       $tm = $info->time;
       $dt = substr($dt,0,4).'.'. substr($dt,4,2).'.'. substr($dt,6,2);
       $tm = substr($tm,0,2).':'. substr($tm,2,2);
       $update=$tm.' '.$dt;
       $data = $info->snap;
        JsonReturn(['code'=>0,'time'=>$update,stp=>$data[5], de=>$data[6], dep=>$data[7],'info'=>$info]); 
          
       }
     }else{
         JsonReturn(['code'=>1,'msg'=>'Request method "GET" not supported']);
     }
 }

<input type="text" id="keyword"><button id="so">搜索</button>
<ul id="data"></ul>
<button class="ajaxMore" style="display: none">加载更多</button>
<script type="text/javascript">
let curpage = 1;
let limit=15;
let sum =0;
let _fields='id,tid,title,keywords,description,litpic,body,htmlurl,target,addtime';
let _serUrl ="/GetData/getDataSearch.html";
let _model='article';
let _key='232323';
let _word = '';
let _title = 'title';
$("#so").click(function(){
    _word = $("#keyword").val();
    let  html='';
    $.ajax({
     url:_serUrl,
     dataType:"json",
     async:true,
     data:{model:_model,key:_key,search:_title,word:_word,fields:_fields,limit:limit,page:curpage},
     type:"POST",
     success:function(r){
         console.log(r);
            sum = r.sum;
             if(sum>=1&&sum<=limit){
                 $(".ajaxMore").show().html('没有更多了!');
            }else if(sum>limit){
                  $(".ajaxMore").show();
            }else{
                $(".ajaxMore").show().html('无相关数据');
            }
            $("#data").html('');
                for(const item of r.data){
                  html+=`<li><h4>${item.title}</h4></li>`;
                }
           $("#data").html(html);    
    },
     error:function(){

    }
    })

})
    
$(".ajaxMore").click(function(){
        curpage++;    
        let html = '';
        $.ajax({
             url:_serUrl,
             dataType:"json",
             async:true,
             data:{model:_model,key:_key,search:_title,word:_word,fields:_fields,limit:limit,page:curpage},
             type:"POST",
             success:function(r){
                 if(r.data.length>0){
                     let allpage = r.allpage;
                    if(curpage<=allpage){
                        if(r.data.length<limit){
                           $(".ajaxMore").text('没有更多了!');
                         };
                        for(const item of r.data){
                              html+=`<li><h4>${item.title}</h4></li>`
                         }
                        $("#data").append(html);
                         

                       }
               }

             }
        })


})


</script>

找到\app\index\taglib\HkCms.php,给breadcrumb添加home字段调用

'breadcrumb'  => ['attr'=>'catid,symbol,home,class,currentstyle,isclick', 'close'=>0],

找到tagBreadcrumb函数添加home默认值;

public function tagBreadcrumb($tag)
    {
        $tag['symbol'] = $tag['symbol'] ?? ' > ';
        $tag['class']   = $tag['class'] ?? '';
        $tag['home']   = $tag['home'] ?? '首页';

找到\app\index\model\cms\Category.php里面getBreadcrumb函数调用 $tag['home'];

 public function getBreadcrumb($tag, $cate = [])
    {
        $home_url = '/';
        //$home_title = lang("Home");
        $home_title = $tag['home'];

        $catid = !empty($tag['catid']) ? $tag['catid'] : ($cate['id']??'');
        if (empty($catid)) {
            return '';
        }

模板里面使用

{hkcms:breadcrumb home="这是自定首页字符串" class="active_a" symbol=" / " /}

app/index/controller/index.php 按照以下代码修改
class Index extends BaseController

{
    protected $middleware = [ // 限制index,show方法需要登录
        \app\index\middleware\Login::class=> ['only'=>['download']]
    ];
    public function initialize()
    {
        parent::initialize();

        // 非开发者模式下,屏蔽非致命错误
        if (!$this->app->isDebug()) {
            // 屏蔽掉notice错误
            //error_reporting(E_ERROR & ~E_WARNING & ~E_NOTICE);
            error_reporting(E_ERROR);
        }

        //前台模板调用会员信息s
        $this->user = \app\index\library\User::instance();
        $user = $this->user->getUser();
        if ($user) {
            $user['group'] = $this->user->getGroups($user['id']);
        }
        $this->view->assign('user', $user);
       //前台模板调用会员信息e

    }