今天和兩位前輩開會後,他給了我方向的指引,告訴我一個新的學習領域
M V C
了解MVC之前,也要先補足我不懂的smarty
東方和風語 - Smarty隨手筆記
MVC三字的解說:
奧托森學習手冊 - 20110821052[PHP] 使用純 PHP 實作 MVC 架構
這是我覺得有很簡單範例而且很詳細解說的參考網站:(*看到一半*)
網站製作學習誌 - 透視 WebMVC
學習筆記
foreach 迴圈:http://pydoing.blogspot.tw/2013/02/PHP-foreach-as.html下例計算 1 到 100 所有整數的和,示範 foreach 迴圈的簡單使用
<?php
$sum
= 0;
$a
= range(1, 100);
foreach
(
$a
as
$i
) {
$sum
+=
$i
;
}
echo
"1 + 2 + .... + 99 + 100 = $sum"
;
/* 《程式語言教學誌》的範例程式
檔名:cf17.php
功能:示範 PHP 程式
作者:張凱慶
時間:西元 2013 年 2 月 */
?>
PHP funtion __contruct :http://note.tc.edu.tw/684.html
php 的建構子會在類別實體化後執行,寫法有兩種,一個是用 __construct() 保留字,另一個是用和類別同名的函式
class BASE{
function __construct(){
print "BASE constructor";
}
}
OR - - - - - -
class BASE{
function BASE(){
print "constructor function same name with class";
}
}
若同時有兩個建構子,則以 __construct() 為優先,同類別名的函數將不會被執行。
PHP funtion ____GET / ____SET :http://xyz.cinc.biz/2013/05/php-getset.html
說明:
public void __set ( string $name , mixed $value )
public mixed __get ( string $name )
__get 執行時機:嘗試取得不存在的屬性或無權訪問的屬性。
__set 執行時機:嘗試設定不存在的屬性或無權訪問的屬性。
想買的書
深入淺出設計:http://www.tenlong.com.tw/items/9867794524
mvc好複雜,好難學
回覆刪除OOP又不是全部可以重用,想到可以重用的只有分頁和SQL class
簡單來說分為
刪除Model
View
Controller
View為呈現給畫面的
Controller 就是控制哪個View用哪個class的
Model為主要程式所在