CodeIgniter send()) 失败
我正在学习如何使用代码点火器并遵循教程。由于这是我第一次使用 MVC,因此在实现发送功能时遇到了一些问题。我正在制作有关如何发送时事通讯注册表单的教程。
由于某种原因,当我点击提交(包含或不包含信息)时,它会给我一个 404 页面,未找到带有 /send 扩展名的页面。我的配置文件中是否缺少某些内容?
提前致谢。
I am learning how to use code igniter and following tutorials. As this is my first time to use MVC, I'm having some trouble implementing the send function. I am doing a tutorial on how send a newsletter sign up form.
For some reason when I hit submit with or without the info, its giving me a 404 page not found with the /send extension. Is there something I'm missing in my config file?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不是发送失败,而是您在配置中遗漏了某些内容。
http://codeigniter.com/user_guide/general/urls.html
您应该设置根据上面的指南创建您的 .htaccess。
Is not send that is failing but you missed something in your config.
http://codeigniter.com/user_guide/general/urls.html
You should set up your .htaccess according to the guide above.
您是否在 .htaccess 中设置了 CodeIgniter 重写规则?
Did you setup the CodeIgniter rewrite rules in your .htaccess?
除了 htaccess 可能存在的问题之外,您发布的文件中还有一些错误:
1) php 类之前的 htmlHEY<title></code> ,但我希望这是一个拼写错误, 正确的?你的控制器文件中没有 html,对吗?
2)你的POST变量是错误的;或者更好的是,你正在混淆和混合事物。
而不是
应该是:
输入类已经检索了这个超全局变量。并让他们有利于自己。
3)要使用附件,您需要调用
您刚刚声明了一个变量,没有其他任何内容。
4) 什么是
$this->email->set_newline("\r\n");
?我在电子邮件类中没有看到这个函数...您需要为此使用配置文件,或者传递库初始化的值:
Apart from the htaccess possible problem, there are a couple of things wrong in the file you posted:
1) the html
<title>HEY<title>
before the php class, but I hope that's a typo, right? you don't have html in your controller file, right?2) You're getting the POST variable wrong; or better, you're confusing and mixing things.
Instead of
should be:
The input class already does the retrieving of this superglobal. And unsets them in favour of its own.
3) To use an attachment, you need to call
You just declared a variable and nothing else.
4) What is
$this->email->set_newline("\r\n");
?I don't see this function in the email class...You need to use a config file for this, or pass the value on library's inizialization: