我需要从codeigniter的URL中删除控制器名称,例如:
www.example.com/controllername/functionname
www.example.com/welcome/aboutus
www.example.com/welcome/ourservices
我需要网址为:
www.example.com/functionname
www.example.com/aboutus
www.example.com/ourservices
然后我还需要为我们的服务提供子菜单,URL应该是这样的:
www.example.com/welcome/our services/service1
www.example.com/welcome/our services/service2
如何在codeigniter中实现此路由?
答案 0 :(得分:1)
如果您只想删除' welcome'来自网址,
你可以这样做: extends Array
答案 1 :(得分:0)
转到application/config/routes.php
并添加
$route['about-us'] = 'welcome/aboutus';
$route['our-services'] = 'welcome/ourservices';
确保功能不应包含空格。它可以是
about_us
public function about_us()
{
# code...
}
答案 2 :(得分:0)
这可以通过动态路由实现。打开config文件夹中的routes.php文件并设置路由。 示例:
from suds import Client
url = "http://ipadress/Webservices/WCF/Service.svc?singleWsdl"
client = Client(url)
response = client.services.GetData(username, password)
要打开about-us页面,你必须从控制器中提供路径,如
urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed>