I am good in web development but recently started using PHP and developed few websites. I learned it myself and developing the website as per the requirement and able to do it without any issue. But I am confused the way I am doing is correct as per industry standard or not. I have see some code using MVC. Which is best practice method we need to follow. How the big company follows? Please ignore the syntax errors, Example Model I am using
Inserting record:
$sql = "insert into ....";
myql_query ($sql) or die (mysql_error());
For Displaying开发者_开发问答
<table> <tr><th>Slno</th> <th> Customer name </th>.... </tr>
<?php
$rs = mysql_query ("select * from customers");
while ($row = mysql_fetch_array($rs))
{
?>
<tr>
<td> <?php echo $row["slno"];?> </td>
<td> <?php echo $row["customername"];?> </td>
</tr>
<? }?>
</table>
Most of big companies using php frameworks like symfony/zend frame work etc...
reasons are easy to maintenance,half of code already written well documention and support
MVC pattern is very good method to develop a web site
You are scratching the surface of a big topic. There is no one industry standard way of programming there are multiple languages, frameworks, design patterns (which MVC is one of), etc. One thing with software design is that it takes a long time and plenty of practice to become familiar with just one of these things.
Different companies will do things different ways, so your best bet is to get some tutorial type material to get you on the right path. I found this book quite useful when starting with PHP and MySQL:
http://www.amazon.com/Beginning-Apache-MySQL-Development-Programmer/dp/0764579665
Once you get familiar with core PHP/MySql syntax and processes you could move onto looking at frameworks such as CodeIgniter, which is an MVC framework - http://codeigniter.com/ I've seen many companies advertise for developers who are familiar with this framework. Of course CodeIgniter is only one of many.
Just keep in mind that it takes a lot of time, and will require many hours of research and practice on your behalf.
If you wish to utilize MVC patterns, then Zend Framework is definately the way to go!
I have been using it for some time now, and i'm not turning back. It can be a bit hairy to master - but the tools at hand are just great.
Another framework that builds on MVC is CakePHP, i haven't been using it but i've heard of it - it should also be ok.
There are many answers to this question, and most of them are going to be mostly opinions.
Personally I would suggest learning about coding with a consistent style, learning the basics of Object Oriented Programming, and learning the basics of MCV.
But all that learning won't help you understand it until you actually put it into practice yourself. For practical purposes I would suggest learning a framework such as CodeIgniter - work through any tutorials you can find, and make a few things on your own with it. This will expose you to concepts that were thought and argued over a great deal already.
精彩评论