开发者

Access method directly from URL

I've watched video tutorial for a little MVC framework(if i can call it fra开发者_Python百科mework) - http://net.tutsplus.com/tutorials/php/create-your-first-tiny-mvc-boilerplate-with-php/ ,i download the source code and changed a little bit the files but I can't figure out how to call a specific method as CodeIgniter's form_open() and make a simple login system.Thanks in advance! So ,how to send POST data from a form to the controller? PS:I don't want to reinvent the wheel, just practicing


I also used this TinyMVC to learn MVC structure,
On your HMTL form:

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

Then in your controller or method just use

$username = $_POST('username');

You have to post to index.php, and it will go to your controller for you to pick up with there. You can also pick it up in a method using the same example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜