在 Codeigniter 中设置链接

发布于 2025-01-07 00:09:27 字数 234 浏览 2 评论 0原文

我正在尝试在 Codeigniter 2.0 中制作一个简单的导航菜单,但无法弄清楚如何链接到我的其他视图。

<ul>
 <li>About</li>
 <li>Links</li>
</ul>

我对我的观点进行了编码。它们是:关于和链接

如何在我的控制器中设置链接?如何在我的视图中设置导航链接?

I'm trying to make a simple navigation menu in Codeigniter 2.0 and cant figure out how to make links to my other views.

<ul>
 <li>About</li>
 <li>Links</li>
</ul>

I have My Views coded. They are: about and links

How do I set up the links in my controller? How do I set up the nav links in my view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最偏执的依靠 2025-01-14 00:09:27

使用锚。例如:

echo anchor('news/local/123', 'My News', 'title="News title"');

将生成: 我的新闻

您需要此 URL 帮助器 $this->load->helper('url');

Use anchor. For example:

echo anchor('news/local/123', 'My News', 'title="News title"');

Would produce: <a href="http://example.com/index.php/news/local/123" title="News title">My News</a>

You need the URL helper for this $this->load->helper('url');

梦境 2025-01-14 00:09:27

您可以使用 CI URL 助手: http://codeigniter.com/user_guide/helpers/url_helper.html< /a>

他们也解释了基本的例子。

You can use CI URL Helper : http://codeigniter.com/user_guide/helpers/url_helper.html

They have explained basic examples as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文