php - Controller 方法链接 : CodeIgniter

标签 php codeigniter

我正在学习有关 CodeIgniter 的教程:

http://ie.mirror.twsweb-int.com/codeigniter/user_guide/tutorial/index.html

教程第4页:

http://ie.mirror.twsweb-int.com/codeigniter/user_guide/tutorial/create_news_items.html

在教程的第4页,他提到你应该创建自己的成功入口页面。

我想在 success.php 上创建一个链接回到索引页面(调用 news_index)。 IE 就 URL 而言,我想要一个来自

的链接
http://example.com/codeigniter/index.php/news/create

http://example.com/codeigniter/index.php/news/

在 CodeIgniter 上制作的动态 URL 怎么样?

最佳答案

首先在您的 Controller 或自动加载文件中加载 URL 助手。

然后使用 site_url() 函数,只传递新闻。

<?php echo site_url('news');?>

关于php - Controller 方法链接 : CodeIgniter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7523650/

相关文章:

php - 点火器 |获取上一个 URL 并用作上一页的后退按钮

php - Codeigniter - 当 URL 以斜杠结尾时,相对 URL 停止工作?

javascript - 如何在 jquery 中创建多维数组/对象并通过 AJAX post 传递

javascript - 在 AngularJS 中执行 $http.post 查询后返回 2 个表

php - mcrypt_decrypt - 奇怪的填充(不是默认的,不是空的)

php - 创建表查询给我 "table does not exists"错误

php - 网址重写不适用于 Apache

php - 无法使用设备向服务器发送数据

php - Codeigniter、选择、结果、数组格式

Codeigniter - View 快照 - 生成 PDF