function mkConnection()
{
    $link = mysqli_connect("localhost", "cl22-tradefev", "FF!Hd/mwj", "cl22-tradefev");
    if (mysqli_connect_error()) {
        echo "Failed to connect to database";
        dies();
    }
    return $link;
}
Example #2
0
 public static function val($key)
 {
     $a = array();
     $a["db_ip"] = "localhost";
     //IP of database
     $a["db_user"] = "******";
     //username of database
     $a["db_pass"] = "******";
     //password of database
     if (!array_key_exists($key, $a)) {
         dies("config static non-existent key [" . htmlspecialchars($key) . "]");
     }
     return $a[$key];
 }
Example #3
0
 protected function render($file = null)
 {
     $path = Template;
     $file = $file ? $file : CTR_NAME . '/' . ACTION_NAME;
     $fullpath = $path . $file . Ext;
     if (!file_exists($fullpath)) {
         dies("模板" . $fullpath . "不存在");
     }
     extract($this->viewData);
     //ob_end_clean();
     ob_start();
     require_once $fullpath;
     $content = ob_get_contents();
     ob_end_clean();
     ob_start();
     $this->viewContent = $content;
     return $content;
 }
Example #4
0
 function __construct($host, $user, $pwd, $name)
 {
     $link = @mysqli_connect($host, $user, $pwd, $name);
     if (!$link) {
         dies("Connect error:" . mysqli_connect_errno() . '--' . mysqli_connect_error());
     }
     if (!@mysqli_set_charset($link, 'utf8')) {
         dies("error:" . mysqli_errno($link) . "--" . mysqli_error($link));
     }
     $this->link = $link;
 }
Example #5
0
 private function Analyse()
 {
     $ControllName = I("get." . C_N, "Index");
     $ActionName = I("get." . A_N, "index");
     if (class_exists("\\Controller\\" . $ControllName) !== FALSE) {
         defined("CTR_NAME") or define("CTR_NAME", $ControllName);
         if (method_exists("\\Controller\\" . CTR_NAME, $ActionName)) {
             defined("ACTION_NAME") or define("ACTION_NAME", $ActionName);
             //获得参数
             $params = $this->get_func_params("\\Controller\\" . CTR_NAME, ACTION_NAME);
             //执行绑定
             $paramValue = $this->bindActionValue($params);
             $spaceControll = "\\Controller\\" . CTR_NAME;
             $Controller = new $spaceControll();
             call_user_func_array(array($Controller, ACTION_NAME), $paramValue);
         } else {
             dies($ActionName . "方法不存在");
         }
     } else {
         dies($ControllName . "控制器不存在");
     }
 }