PHP
PHP
2023/06/27 (內容重整)
2023/10/06 (新增8.2->8.3的差異及新增PDO頁面)
2024/06/09 (新增常見問題)
本網站原為吳濟聰老師Web Programming教學網站,現為系統分析與設計補充教材網站,內容較舊,將會陸續更新內容
Web前端複習
PHP基礎
PHP Tutorial (W3Schools)
開發環境
第一個PHP程式
基本語法與輸出
變數
判斷式
迴圈
陣列
函數
PHP與資料庫
進階概念
常見問題
XAMPP的MySQL常常打不開:不管怎麼按都無法正常Start
如果是在windows下,建議將Apache及MySQL設為服務,避免不正常關機導致資料庫毀損
設定方式:以系統管理員身份打開XAMPP Control Panel,將Apache及MySQL設為服務
資料庫常見問題
詳見資料庫
參考資料
Developing as a Software Developer: 7 Methods for Faster Coding Mastery
#1: Stop Taking Extensive Notes
#2: Learn Content in Small Chunks
#3: Learn by Doing
#4: Handwrite Your Code
#5: Explain Your Code
#6: Refactor
#7: Teach What You Learned to Someone Else
How To Learn a New Programming Language Fast: The first step is figuring out your unique learning style
Visual learner
If you are a visual learner, you love visualizing ideas and concepts. You can create mind maps of the concepts.
Auditory learner
If you are an auditory learner, then you are likely to learn by listening to someone talk about the subject.
Reading/writing learner
If you are a reading/writing learner, then you are likely to learn from reading programming books and taking notes.
Kinesthetic learner
If you are a Kinesthetic learner, then you learn best by doing. You like to engage in learning that involves physically acting out what you have learned.
20 Things That Are Good to Know When You Start Web Developing
You don’t need a degree to program
Googling is a skill
You can’t learn everything
Writing easy code is the hardest thing to do
Keep your code as simple as possible.
There’s no time for proper testing
Most developers will agree that testing is not the most fun part of their job.
Once there’s the slightest idea of missing the deadline, one of the first things that get sacrificed is testing.
This really happens, even though everybody agrees that it’s not good for the end result.
Time estimations are never even close
You’ll feel ashamed when you look back at your old code
clean up the mess that you made earlier.
You’ll spend way too much time looking at bugs
Internet Explorer is the worst browser that was ever created
Work stops when servers are down
You’ll pretend that you understood everything your colleague said
You don’t need to memorize everything
You need to be a good problem solver
You will be reading a lot
Responsive can be a pain
Knowing how to debug saves lots of time
You’ll be looking at suggested solutions that won’t work for your problem
Most of the time, you’ll find suggested solutions on forums, like StackOverflow, that will give you a good push in the right direction.
But also most of the time, the suggested solution can’t be simply copied and pasted to solve your problem.
A good IDE will make your life much easier
Working with the terminal can make you more efficient
Don’t reinvent the wheel
10 Mistakes You Should Avoid as a Web Developer
Not tracking errors in production
Making Changes directly on the Server
Downtime while deploying
Not Worrying about security in the code
Not Notifying Team Members
Using The Same Environment for Development and Production
Having No Backup Plan
Not using Caching on the client side
Caching
Lazy Loading
Performing Manual Deployments
Poorly Communicating When a Deployment Occurs
PHP is Still Dominating the Web
One of the reasons that PHP is used by so many websites is because WordPress uses PHP. The market share of WordPress is approximately 34 percent of all websites. That’s 75 million websites using WordPress.
Building Websites From Scratch
PHP was and still is a very popular language. One of the reasons for this is that it’s a really easy programming language to learn. That makes it an excellent language for people new to building websites.
Programming
A popular PHP framework that is very clean is Laravel. The advantage of working with a framework is that a lot of the dirty work is done under the hood. The framework forces you into writing cleaner code.
PHP 7
Since the release of PHP 7 a lot of new features and improvements have been introduced.
逐步提昇PHP技術能力 - 逐步改善軟體架構
REST
React
Web Framework
教學 (官方教學)
自學CodeIgniter跌跌撞撞30天 系列 (2.2.6) (大部分內容是參考CodeIgniter官方教學)
First Codeigniter 3 CRUD (Create,Read,Update,Delete) via Mysql
11 Best PHP Frameworks for Modern Web Developers in 2019
Laravel (43%)
Coming in at number 1 on our list, is Laravel. Laravel is a comprehensive framework designed for rapidly building applications using the MVC architecture. Laravel is currently the most popular PHP framework, with a huge community of developers.
CodeIgniter (14.9%)
Codeigniter is an ideal framework for rapid application development. It’s a lightweight, low-hassle, framework with a small footprint that can be installed just by uploading it directly to your hosting. No special command line or software installation is required. Upload the files and you’re ready to go.
Symfony (13.6%)
Symfony has been touted for a while now as a very stable, high performance, well documented, and modular project. Symfony is backed by the French SensioLabs, and has been developed by them and it’s community to be a fantastic framework.
Zend (12.5%)
Zend Framework is a popular, go-to professional framework commonly used for high-performance enterprise-level applications. Zend is built with security, performance, and extensibility in mind.
see Google Trends
10 Popular PHP frameworks in 2019
Introduced in 2011, Laravel has become the most popular free, open-source PHP framework in the world. Why? Because it can handle complex web applications securely, at a considerably faster pace than other frameworks. Laravel simplifies the development process by easing common tasks such as routing, sessions, caching, and authentication.
Known for its small footprint (it’s only about 2 MB in size, including the documentation) CodeIgniter is a PHP framework suitable for developing dynamic websites. It offers numerous prebuilt modules that help with constructing robust and reusable components.
The Symfony framework was launched in 2005, and although it’s been in existence for much longer than other frameworks on this list, it’s a reliable and mature platform. Symfony is an extensive PHP MVC framework and the only framework known to follow PHP and web standards to the tee.
If you’re looking for a toolkit that’s simple and elegant, look no further. CakePHP will help you develop visually impressive, feature-loaded websites. In addition, CakePHP is one of the easiest frameworks to learn, especially because of its CRUD (create, read, update, and delete) framework. CakePHP hit the market in the early 2000s, and since then it’s gained better performance and many new components.
8 Best PHP Frameworks for Web Developers
With Lavarel, you can get to work on your projects rapidly. You’ll also be able to skip a lot of groundwork since you get access to functions such as user authentication, session management, and caching. Overall, Laravel packs all the functionality you’ll need to build a modern PHP application, which is saying a lot.
If you’re new to PHP frameworks, CodeIgniter can be an excellent choice, because it’s rather easy to learn and get started with. Plus, the platform boasts excellent documentation, which means you shouldn’t have too much trouble learning the basics. CodeIgniter also offers solid performance, which means it’s perfect if you want to build lightweight applications that run well on modest servers.
Along with having a cool name, Symfony is highly flexible. It features a bundle and component system that enables you to cherry-pick the PHP functions you need, or simply use the entire framework.
A lot of people refer to Zend as a ‘glue’ framework, which is a way of referring to its component-based nature. Zend is an object-oriented, MVC-based framework that enables you to load only the components you want as individual libraries.
Top 10 PHP Frameworks for Web Development
Laravel has many features that make rapid application development possible. The Artisan command-line interface provides a number of helpful commands while developing the application. Laravel has a powerful templating engine too, which enables common tasks such as authentication, caching, sessions, RESTful routing, and queuing easier for developers.
Symfony is another popular PHP framework that empowers developers with a set of reusable PHP components and code. When it comes to developing large-scale enterprise projects, Symfony makes a perfect choice among PHP frameworks. The components of the Symfony framework are used by many content management systems like Drupal, PHPBB, PIWIk, OROCRM and even the popular Laravel itself uses it.
Zend packs a range of features such as a user-friendly drag and drop editor, cryptographic coding tools, a connected Database Wizard, and instant online debugging tools. Its editor supports front-end technologies like HTML, CSS and JavaScript as well. The scalable framework is ideal for complex websites as it offers a myriad of configuration options. However, it is one of the most difficult to learn.
CodeIgniter is one of the oldest frameworks but is simple and powerful. It can easily be installed and requires minimal user configuration. It works perfectly on almost all shared and dedicated hosting platforms. CodeIgniter isn’t entirely based on the MVC framework. Models and Views are optional, but Controller classes are a must. Another strength of CodeIgniter is speed. It runs faster with database tasks in comparison to other frameworks. CodeIgniter is well documented and a good framework to start with for PHP beginners.
CakePHP is already a decade old, but it’s still among the most popular PHP frameworks. CakePHP brings speed, reliability, and security. It has great support from the community of developers to keep up with the latest technology trends. It’s a modern framework and is properly suited for commercial web applications. Form validation, SQL injection prevention, good documentation, cross-site request forgery (CSRF) protection, cross-site scripting (XSS) prevention are unbeatable features of CakePHP.
10 Best PHP Frameworks for Web Development in 2019
The reason for its wide popularity boils down to ease of use and virtually no learning curve. And despite that, it’s a framework developer use for some serious work. So it may seem like a simple tool at first, but it’s a beast when it comes to producing concrete work.
Unlike Laravel, Symfony has a steep learning curve owing to the vast amount of features it has to offer. However, the fast growing community and several unofficial support groups make it a lot easier to learn and get familiar with what the framework has to offer.
Released in 2005 and available under the MIT license, CakePHP is completely free to use whether it is for personal or commercial use. At earlier stages, the CakePHP attracted names like Hyundai, Express, and BMW, etc. as its corporate users, and you can reflect on how important it was in its early stages.
A powerful PHP framework with advanced features, CodeIgniter is the go-to framework for developers who want to develop their projects quickly. It contains a library which has a simple interface and requires a logical structure to access. CodeIgniter shines for many developers because it allows them to focus on the creativity part and requires little to no coding tasks.
Zend is a highly powered PHP framework that provides rapid application development. Recommended by wide community of developers, Zend framework is one of the most advanced PHP frameworks in the market.
10 PHP MVC Frameworks in 2019 for Modern Web Developers
A popular framework introduced in 2011 falls in our PHP MVC framework list, Laravel. The framework’s main goal is to take the drag from development to make it more fun and enjoyable for developers. Laravel’s philosophy suits very well mostly among millennial web developers gaining a wide community. Laravel achieved this output by easing common tasks like authentication, routing, sessions, and caching. It is pleasing even without sacrificing functionality, making it very suitable for beginners of PHP.
CodeIgniter is considered one of the oldest PHP framework, a brainchild of Rick Ellis in 2006. Being a classic doesn’t imply that this framework is outdated; it only means that CodeIgniter has gone through a lot of trials, errors, and updates that made it more mature and reliable as a PHP MVC framework. Codeigniter is well documented and supported by a vast community which makes a great advantage for web developers for technical support. The framework’s main strength lies on its speed that competes with the other recent frameworks.
Launched in 2005, Symfony can also be considered as a sophisticated web development platform. Similar to CodeIgniter, its years in the industry garnered a wide range of community for as well as a lot of updates and upgrades to better help web developers. Since Symfony has had a head start from the other frameworks, it has established quite a reputation among web developers with mature, solid features and a large active following. However, its advanced features would make a difficult learning curve for novice developers.
Implemented using 100% object-oriented concept with features like inheritance and interfaces. Its wide range of features includes drag-and-drop editor, cryptographic coding tools, and instant online debugging tools among the many others. The only detrimental side of Zend Framework is its complex components making it one of the most difficult PHP framework in the list.
CakePHP was said to be one of the easiest frameworks to learn. The creators of this easy and reliable framework managed to develop the CRUD concept which means create, read, update, and delete. Already a decade old but is still one of the most popular PHP frameworks, CakePHP helps developers create visually impressive feature-loaded websites.