Example #1
0
#!/var/lib/php
<?php 
//include_once("connect.php");
//phpinfo();
//var_dump time();
//var_dump "<br>/n";
//var_dump mktime(0, 0, 0, 6, 18, 2015);
$util = new phpUtil();
//$util->getPage();
$util->test();
class phpUtil
{
    private $appId;
    private $appSecret;
    public function init($appId, $appSecret)
    {
        $this->appId = $appId;
        $this->appSecret = $appSecret;
    }
    public function test()
    {
        /*
        $sql = "select * from cj_scene";
        $pagQuery = mysql_query($sql);
        if ($rowPage = mysql_fetch_array($pagQuery)) {
            print_r( strtotime($rowPage['publish_time']) );
            //print_r('\n');
            var_dump( strtotime($rowPage['createtime_time']) );
        }
        */
        var_dump(date("Y-m-d h:i:s", 1435585613));
Example #2
0
 * PHP 是 "PHP Hypertext Preprocessor" 的首字母缩略词
 *
 * this is a help to teach you how to use PHP
 * */
include_once "connect.php";
//require 会生成致命错误(E_COMPILE_ERROR)并停止脚本; include 只生成警告(E_WARNING),并且脚本会继续
date_default_timezone_set("Asia/Shanghai");
// 一些基本的配置: display_errors、 log_errors、 error_reporting、 error_log
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);
//常量
define("GREETING", "Welcome to W3School.com.cn!", true);
//规定常量名是否对大小写敏感。默认是 false
$x = 6;
$util = new phpUtil();
$util->help();
echo "I'd like an {${help::softdrink}} ";
/*
 * 魔术方法
    __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(),
    __toString(), __invoke(), __set_state(), __clone() 和 __debugInfo() 等方法在 PHP 中被称为"魔术方法"(Magic methods)。
    在命名自己的类方法时不能使用这些方法名,除非是想使用其魔术功能。
 * */
class BaseClass
{
    public $one = 1;
    function __construct()
    {
        print "In BaseClass constructor\n";
    }