dtp0760 2015-05-27 21:51
浏览 40
已采纳

如何将.php扩展名添加到Codeigniter 2.x控制器URL

I am using Codeigniter 2.x for a project and have limited knowledge on .htaccess etc.

I've created an RESTful api which can be accessed via "api" controller's "getfeedback" function and was able to remove the index.php from the URL using .htaccess rules.

Example That currently works (without .php extension):

www.example.com/api/getfeedback?param=abc&param2=defghi

The team I created the api for asked if I can create something which has the .php extension in the urls for some reason they can't use it without the extension. I am able to achieve this if I create a pure php file outside of my codeigniter project directory, however I would like to use codeigniter framework to keep everything consistent. Basically I am looking for a way to have the URL be accessed via

Looking for:

www.example.com/api/getfeedback.php?param=abc&param2=defghi

How can I achieve this? Is there some kind of configuration that would allow both methods to work? Any help is greatly appreciated.

  • 写回答

1条回答 默认 最新

  • douning5041 2015-05-27 22:01
    关注

    Took me like 10 seconds to find this on Google:

    http://www.codeigniter.com/userguide2/general/urls.html

    Adding a URL Suffix

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助