Một phần kiến thức trong lập trình PHP căn bản đó là xử lý thời gian, ngày, tháng với hàm Date[] và Time[]. Bài viết sau sẽ hướng dẫn bạn cách sử dụng Date và Time một cách dễ dàng. Cú pháp: date[ $format, $timestamp]; $format: định dạng biến trả vểHàm Date[] trong PHP và cách sử dụng
$timestamp: là số nguyên Unix timestamp. nếu để trống nó sẽ lấy về thời gian hiện tại.
Các kiểu Format:
h: Trả về giờ trong ngày kiểu 12h
H: Trả về giờ trong ngày kiểu 24h
i: Trả về phút trong giờ
s: Trả về số giây trong phút
d: trả về ngày trong tháng[từ 1- đến31]
j: Trả về ngày trong tháng, nhưng nếu ngàyHàm time[] PHP sẽ lấy thời gian về thời điểm hiện tại. Nó sẽ trả về số giây tính từ thời điểm 00:00:00 1/1/1970.
Cú pháp:
time[]
Ví dụ:
Kết thúc bài học này bạn đã hiểu 2 hàm date[] và time[] để lấy lấy ngày giờ hiện tại trong PHP chưa nào? Trong những bài tiếp theo mình sẽ tiếp tục chia sẻ những kiến thức PHP hay nhất mời bạn cùng tiếp tục theo dõi tại Quach Quynh blog nhé!
This list includes the core php.ini directives you can set to configure your PHP setup. Directives handled by extensions are listed and detailed at the extension documentation pages respectively; Information on the session directives for example can be found at the sessions page.
Note:
The defaults listed here are used when php.ini is not loaded; the values for the production and development php.ini may vary.
Language Options
Language and Misc Configuration Options
NameDefaultChangeableChangelog short_open_tag "1" PHP_INI_PERDIR precision "14" PHP_INI_ALL serialize_precision "-1" PHP_INI_ALL Prior to PHP 7.1.0, the default value was 17. disable_functions "" PHP_INI_SYSTEM only disable_classes "" php.ini only exit_on_timeout "" PHP_INI_ALL expose_php "1" php.ini only hard_timeout "2" PHP_INI_SYSTEM Available as of PHP 7.1.0. zend.exception_ignore_args "0" PHP_INI_ALL Available as of PHP 7.4.0 zend.multibyte "0" PHP_INI_ALL zend.script_encoding NULL PHP_INI_ALL zend.detect_unicode NULL PHP_INI_ALL zend.signal_check "0" PHP_INI_SYSTEM zend.assertions "1" PHP_INI_ALL with restrictions zend.exception_string_param_max_len "15" PHP_INI_ALL Available as of PHP 8.0.0. Here's a short explanation of the configuration directives.
short_open_tag
boolTells PHP whether the short form [
] of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use
inline. Otherwise, you can print it with PHP, for example:
. Also, if disabled, you must use the long form of the PHP open tag [
].
Note:
This directive does not affect the shorthand