久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何實(shí)現(xiàn)markdown轉(zhuǎn)html

      php實(shí)現(xiàn)markdown轉(zhuǎn)html的方法:用markdown編輯api的方式,代碼為【$fileContent = file_get_contents(storage_path('doc/admin_api.md'))】。

      php如何實(shí)現(xiàn)markdown轉(zhuǎn)html

      【相關(guān)學(xué)習(xí)推薦:php編程(視頻)】

      php實(shí)現(xiàn)markdown轉(zhuǎn)html的方法:

      使用插件實(shí)現(xiàn)markdown轉(zhuǎn)為html

      功能很簡(jiǎn)單,就直接上代碼啦。

      <?php namespace AppHttpControllersAdmin; use IlluminateHttpRequest; use AppHttpControllersController; use Parsedown; class ApiDocController extends Controller {     public function __construct(){         $this->markdownParser = new Parsedown();     }     public function showDoc(Request $request){         $fileContent = file_get_contents(storage_path('doc/admin_api.md'));         $htmlContent = $this->convertMarkdownToHtml($fileContent);         $content = $this->convertMarkdownToHtml($htmlContent);         return view('apidoc_admin')->with('content',$content);     }     public function convertMarkdownToHtml($markdown)     {         $convertedHmtl = $this->markdownParser->setBreaksEnabled(true)->text($markdown);         return $convertedHmtl;     } }

      本文推薦的就是用markdown編輯api的方式,md就是markdown文件的后綴,我現(xiàn)在把這個(gè)文件放在storage/doc/admin_api.md處。

      為了測(cè)試,我暫時(shí)在文件里粘貼了一個(gè)markdown格式的api:

      **簡(jiǎn)要描述:**  - 用戶登錄接口 **請(qǐng)求URL:**  - ` http://xx.com/api/user/login `    **請(qǐng)求方式:** - POST  **參數(shù):**  |參數(shù)名|必選|類型|說(shuō)明| |:----    |:---|:----- |-----   | |username |是  |string |用戶名   | |password |是  |string | 密碼    |  **返回示例** ```    {     "error_code": 0,     "data": {       "uid": "1",       "username": "zhai coder",       "name": "璇哈",       "groupid": 2 ,       "reg_time": "2019-08-01",       "last_login_time": "0",     }   } ```  **返回參數(shù)說(shuō)明**  |參數(shù)名|類型|說(shuō)明| |:-----  |:-----|-----                           | |groupid |int   |用戶組id,1:超級(jí)管理員;2:普通用戶  |  **備注**  - 

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)