ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯系官方銷售客服

1835022288

028-61286886

投訴 解決中 / 官方已回 /book/diyizhangjie.html 章節偽靜態怎么寫 4 0
迅睿CMS版本:4.2.0 懸賞:5元

/book/diyizhangjie.html 章節路徑是這樣的

diyizhangjie 這段每個章節的標題拼音


請問rewrite.php里面偽靜態怎么寫 來對應/book/diyizhangjie.html 這個路徑


章節動態路徑 是這個 /index.php?s=book&c=son&m=show&id=10244


非常感謝






解決方案
  • 插件不支持這種自定義字段的url,他必須有id才行,例如/book/10244.html

    --------非要這么來book/diyizhangjie.html,只能對son控制器進行二次開發,來找內容,否則內容是找不到的,就是404了

  • 那獲取內容頁面拼音

    /xiaoshuoneirongye/10244.html

    這個如何寫

  • 1、打開 config/custom.php 添加自定義方法

    function book_url($data)

    {

    $py = \Phpcmf\Service::L('pinyin')->result($data['title']);

    \Phpcmf\Service::L("cache")->set_file("dr_book_".$py, $data['id'], "dr_book");

    return "/book/" . $py . ".html";

    }

    2、URL規則上填



    3、打開 config/rewrite.php 把原來的內容規則

    /***********************獨立模塊測試規則:內容頁面的偽靜態解析*************************/

    "([a-z]+)\/show\/([0-9]+).html(.*)" => 'index.php?s=$1&c=show&id=$2',

    改成

    "([a-z]+)\/([a-z0-9]+).html(.*)" => 'index.php?s=$1&c=show&id=$2',

    4、打開 dayrui/App/Book/Controllers/Show.php 找到第6行的index方法

    public function index() {

    $this->_module_init();

    $this->_Show(

    (int)\Phpcmf\Service::L('Input')->get('id'),

    [

    'field' => dr_safe_replace(\Phpcmf\Service::L('Input')->get('field')),

    'value' => dr_safe_replace(\Phpcmf\Service::L('Input')->get('value')),

    ],

    max(1, (int)\Phpcmf\Service::L('Input')->get('page'))

    );

    }

    改成

    public function index() {

    $this->_module_init();

    $id = \Phpcmf\Service::L('Input')->get('id');

    if ($cid = \Phpcmf\Service::L("cache")->get_file("dr_book_".$id , "dr_book")) {

    $id = $cid;

    }

    $this->_Show(

    (int)$id,

    [

    'field' => dr_safe_replace(\Phpcmf\Service::L('Input')->get('field')),

    'value' => dr_safe_replace(\Phpcmf\Service::L('Input')->get('value')),

    ],

    max(1, (int)\Phpcmf\Service::L('Input')->get('page'))

    );

    }

    5、更新URL



    高端程序員往往采用最樸素的編程方式,若不是貧窮,誰愿意弄的自己一身才華!
  • 回復@LandQ 兄弟首先非常感謝你 但是按你操作 還是不能打開頁面,拼音轉換時可以的