PHP 時區設定的三種方法

2021-10-03 16:20:02 字數 858 閱讀 3147

在php目錄中的php.ini 裡找到date.timezone項。

設定date.timezone=「asia/shanghai」

重啟執行環境

在執行的頁面新增date_****ult_timezone_set(「prc」);

頁面加上設定時區

ini_set(「date.timezone」,『asia/shanghai』)

首先獲取檔案資訊

$fileinfo

=$_files

['file'];

#獲取檔案資訊

$filename

=$fileinfo

['name'];

#獲取檔名

$type

=$fileinfo

['type'];

#獲取檔案型別

$tmpname

=$fileinfo

['tmp_name'];

#獲取檔案臨時路徑

$filesize

=$fileinfo

['size'];

#獲取檔案大小

$error

=$fileinfo

['error'];

# 獲取上傳時的錯誤型別

$ext

=pathinfo

($fileinfo

,pathinfo_extension);

# 獲得檔案的字尾名 在重名時會用上

move_uploaded_file

($tmpname

,$newfilepath);

# 移動上傳檔案到設定的目錄中 還需判斷目標資料夾中是否存在檔案

PHP爬蟲的三種方法

定義 file get contents 函式把整個檔案讀入乙個字串中。語法 file get contents path,include path,context,start,max length 引數 描述path 必需。規定要讀取的檔案。include path 可選。如果也想在 includ...

Hive設定引數的三種方法

hive提供三種可以改變環境變數的方法 1.修改 conf hive site.xml配置檔案 在hive中,所有的預設配置都在 conf hive default.xml檔案中,如果需要對預設的配置進行修改,可以建立乙個hive site.xml檔案,放在 conf目錄下。裡面可以對一些配置進行個...

PHP刪除目錄的三種方法

1 遞規法 利用遞迴一層一層地刪除 deletedir dir else closedir dp else 2 系統呼叫法 function del dir dir else 3 迴圈法 function deltree pathdir else 如果是檔案就直接刪除 if is dir pathd...