我一直在学习php,只是在学习它。
我希望有人能在安全、流程和一般最佳实践方面为我指明正确的方向?
谢谢
编辑--
I suppose a better way to phrase what i am trying to ask is..
What is the best practice:
1.) when processing forms with php, get vs post, $_REQUEST vs $_GET & $_POST
2.) when dynamically creating HTML files (example below)
3.) logins & authentication in the same file as the form creator
4.) Sending e-mail with php
来自上面的#2
<?php
echo "<h1> Welcome </h1>";
if ($_SESSION[ type ] == "admin")
{
//lots of html in the echo statment
echo "tables and admin interface here";
} else
{
//lots of html in the echo statment
echo "tables and user dashboard here";
}
?>
--VS--
<h1> Welcome </h1>
<?php
if ($_SESSION[ type ] == "admin")
{
?>
lots of html in the echo statment
tables and admin interface here
<?php
} else
{
?>
lots of html in the echo statment
ables and user dashboard here
<?php
}
?>
--VS--
<?php if($_SESSION[ username ]): ?>
<p>You are logged in as <?=$_SESSION[ username ]?></p>
<p><a href="?logout=1">Logout</a></p>
<?php endif; ?>
ps: Thanks to everyone who already responded. Can I also inquire where does a framework fit? I took a class in OOP and we didn t become familiar with any frameworks.
我读了很多关于Symfony和zend框架的文章,但仍然感到困惑。
再次感谢。