直接从URL访问方法


Access method directly from URL

我看过一个小MVC框架的视频教程(如果我可以称之为框架)- http://net.tutsplus.com/tutorials/php/create-your-first-tiny-mvc-boilerplate-with-php/,我下载源代码,改变了一点文件,但我不知道如何调用一个特定的方法作为CodeIgniter的form_open(),并使一个简单的登录系统。提前感谢!那么,如何将POST数据从表单发送到控制器呢?PS:我不想重新发明轮子,只是练习

我还用这个TinyMVC学习MVC结构,
在你的html表单上:

<form method="POST" action="yoururl.com/index.php">
<input type="text" name="username" id="username"/> // name or ID.
<input type="submit" value="submit"/>
</form>

然后在控制器或方法中使用

$username = $_POST('username');

你需要post到index。php,它会到你的控制器,让你在那里拾取。您也可以使用相同的示例在方法中选择它。