Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- * Description of Json
- *
- * @author fabi0
- */
- namespace Controllers;
- class Json {
- protected $_databaseInstance;
- public function __construct() {
- $this->_databaseInstance = new \Models\Database(\Models\Config::mysql_host, \Models\Config::mysql_dbName, \Models\Config::mysql_username, \Models\Config::mysql_password);
- $sess = new \Models\Sessions($this->_databaseInstance);
- $sess->start_session(\Models\Config::cookie_session_name, false);
- header('Content-Type: application/json');
- }
- public function get($method = '') {
- if (method_exists($this, $method)) {
- echo json_encode($this->{$method}());
- } else {
- echo "Method not found";
- }
- }
- private function category() {
- $category = new \Models\Category($this->_databaseInstance);
- return $category->getCategoryTree();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement