This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once('connection.php'); | |
| if (isset($_GET['controller']) && isset($_GET['action'])) { | |
| $controller = $_GET['controller']; | |
| $action = $_GET['action']; | |
| } else { | |
| $controller = 'pages'; | |
| $action = 'home'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once('connection.php'); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Db { | |
| private static $instance = NULL; | |
| private function __construct() {} | |
| private function __clone() {} | |
| public static function getInstance() { | |
| if (!isset(self::$instance)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** Cấu trúc | |
| foreach(array as value){ | |
| foreach(array as value){ | |
| Statement; | |
| } | |
| Statement; | |
| } | |
| **/ | |
| $color= array( "M", "XL", "XXL"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /**Cấu trúc | |
| while(condition){ | |
| while(condition) { | |
| statement(s); | |
| increment/decrements; | |
| } | |
| statement(s); | |
| increment/decrements; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"); | |
| var router = express.Router(); | |
| //localhost:3000/admin/ | |
| router.use("/", function(req, res) { | |
| console.log(req.url); | |
| res.json({"message" : "This is Admin Default Page"}); | |
| }); | |
| //localhost:3000/admin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"); | |
| var app = express(); | |
| app.get('/', function(req, res){ | |
| res.send("This is first application"); | |
| }); | |
| app.listen(3000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require("http"); | |
| var fs = require("fs"); | |
| var path = require("path"); | |
| var model = require("./model"); | |
| //request | |
| //response : tra ve ket qua cho nguoi dung, dinh nghia kieu du lieu se tra ve | |
| var server = http.createServer(function(req, res) { | |
| console.log("Incoming Request" , req.method, '- ', req.url); |