久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

從cakephp中的Url中刪除動作名稱?

Remove action name from Url in cakephp?(從cakephp中的Url中刪除動作名稱?)
本文介紹了從cakephp中的Url中刪除動作名稱?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

可能的重復:
如何從 cakephp 中的 url 中刪除動作名稱?

我正在使用 cakephp 在 Cakephp 中開發我的網站,我想從應用程序 URL 中刪除操作(或視圖)名稱,我應該怎么做.我的要求是最近我想添加參數來代替視圖名稱,我的 URL 如下所示:

I am using cakephp to develop my website in Cakephp and I would like to remove action(or view )name from the application URL what should I do fro that. My requirement is I want to add the parameters in place of view name recently my URL is like:

域名/控制器名/視圖名/param1/param2"

"domainname/controllername/viewname/param1/param2"

但我需要

域名/控制器名/param1/param2"

"Domainname/controllername/param1/param2"

我的 .htaccess 文件如下

My .htaccess files are like below

根文件夾中的.htaccess

.htaccess in root folder

<IfModule mod_rewrite.c>
   RewriteEngine on 
   RewriteRule    ^$     [L]
   RewriteRule    (.*) app/webroot/index.php/$1 [L]
</IfModule>

.htaccess 在應用程序文件夾中

.htaccess in app folder

 <IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /liberty_new/app/
  RewriteRule    ^$    webroot/index.php/    [L]
  RewriteRule    (.*) webroot/index.php/$1    [L]
 </IfModule>

.htaccess 在 webroot 文件夾中

.htaccess in webroot folder

<IfModule mod_rewrite.c>
 RewriteEngine ON
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ /$1 [QSA,L]
</IfModule>

推薦答案

您在 Config outes.php 文件中執行此操作.設置 Router 參數以根據需要編寫 URL.不要編輯您的 htaccess 文件,否則它會/會破壞 CakePHP 路由.

You do this in your Config outes.php file. Set the Router params to write the URL as you need. Do not edit your htaccess files or it can/will break CakePHP routing.

Router::connect('/:controller/:param1/:param2', array('action' => 'index'), array('param1' => '[a-zA-Z0-9]+', 'param2' => '[a-zA-Z0-9]+'));

這應該將所有請求發送到任何控制器到該控制器的索引函數并傳遞參數 1 和 2.當然,這可以高度定制.我強烈建議您閱讀文檔中有關路由的內容,除非必須,否則不要更改 htaccess.

This should send all requestes to any controller to the index function of that controller and pass params 1 and 2. Of course, this can be heavily customized. I would strongly suggest you read about routing in the documentation and never alter htaccess unless you have to.

http://book.cakephp.org/2.0/en/development/routing.html#routes-configuration

這篇關于從cakephp中的Url中刪除動作名稱?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內存大小為 134217728 字節已用盡(嘗試分配 87 字節))
主站蜘蛛池模板: 中文字幕中文字幕 | 亚洲欧美视频在线观看 | 欧美色综合一区二区三区 | 一区二区免费视频 | 亚洲一区二区中文字幕 | 国产 日韩 欧美 中文 在线播放 | 日韩精品在线视频免费观看 | 激情一区 | 国产精品精品久久久 | 亚洲精品一 | 97久久精品午夜一区二区 | 别c我啊嗯国产av一毛片 | 精品久久久久久国产 | 看av网址 | 日韩男人天堂 | 不卡视频在线 | 国产精品久久国产愉拍 | 91久久国产综合久久 | 精品国产黄色片 | 国产精品精品久久久 | 久久狠狠 | av毛片 | 成人免费视屏 | 玖玖精品 | 日韩欧美在线观看视频 | 免费一级做a爰片久久毛片潮喷 | 91精品在线播放 | 日韩最新网站 | 精品一区二区三区在线视频 | 国产激情免费视频 | 美日韩精品 | av电影手机版 | 久久久高清 | 久久99网 | 国产精品综合一区二区 | 精品一区二区三区中文字幕 | 国产精品久久777777 | 青青草原综合久久大伊人精品 | 九九免费视频 | 成人免费看片又大又黄 | 婷婷毛片 |