Phiên bản trước của cả hai bênPhiên bản trướcPhiên bản sau | Phiên bản trướcPhiên bản sauPhiên bản sau của cả hai bên |
programming4:class [2018/02/27 14:11] – [$nv_Cache] hoaquynhtim99 | programming4:class [2020/11/02 10:39] – [Images class] hoaquynhtim99 |
---|
* Lấy số thực: <code php>$nv_Request->get_float($name, $mode = null, $default = null, $decode = true);</code> | * Lấy số thực: <code php>$nv_Request->get_float($name, $mode = null, $default = null, $decode = true);</code> |
* Lấy số nguyên: <code php>$nv_Request->get_int($name, $mode = null, $default = null, $decode = true);</code> | * Lấy số nguyên: <code php>$nv_Request->get_int($name, $mode = null, $default = null, $decode = true);</code> |
| * Lấy số nguyên không âm (thêm vào từ bản 4.3.08): <code php>$nv_Request->get_absint($name, $mode = null, $default = null, $decode = true);</code> |
* Lấy giá trị logic: <code php>$nv_Request->get_bool($name, $mode = null, $default = null, $decode = true);</code> | * Lấy giá trị logic: <code php>$nv_Request->get_bool($name, $mode = null, $default = null, $decode = true);</code> |
* Kiểm tra tồn tại của một request: <code php>$nv_Request->isset_request($names, $mode, $all = true);</code> | * Kiểm tra tồn tại của một request: <code php>$nv_Request->isset_request($names, $mode, $all = true);</code> |
| |
Các thư viện này được đặt trong thư mục ''vendor'' hỗ trợ autoload theo chuẩn PSR-4 | Các thư viện này được đặt trong thư mục ''vendor'' hỗ trợ autoload theo chuẩn PSR-4 |
==== Upload class ==== | ==== Upload Class ==== |
Dùng để upload một file lên hệ thống. | Dùng để upload một file lên hệ thống. Xem [[programming4:class:upload|Hướng dẫn chi tiết cách sử dụng class Upload để tải file lên hệ thống]] |
* Khởi tạo: <code php>$upload = new NukeViet\Files\Upload($allow_files_type, $global_config['forbid_extensions'], $global_config['forbid_mimes'],NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);</code> | * Khởi tạo: <code php>$upload = new NukeViet\Files\Upload($allow_files_type, $global_config['forbid_extensions'], $global_config['forbid_mimes'],NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);</code> |
* Lưu một file tải lên: <code php>$upload ->save_file($userfile, $savepath, $replace_if_exists = true);</code>$userfile là biến $_FILE($file_upload); | * Lưu một file tải lên: <code php>$upload ->save_file($userfile, $savepath, $replace_if_exists = true);</code>$userfile là biến $_FILE($file_upload); |
* Tải file về: <code php>$download->download_file();</code> | * Tải file về: <code php>$download->download_file();</code> |
==== Images class ==== | ==== Images class ==== |
| |
| Xem [[programming4:class:image|Hướng dẫn chi tiết cách sử dụng class Image để xử lý ảnh]] |
| |
* Khởi tạo: <code php>$image = new NukeViet\Files\Image(NV_ROOTDIR."/images/logo.png", $max_width,$max_height);</code> | * Khởi tạo: <code php>$image = new NukeViet\Files\Image(NV_ROOTDIR."/images/logo.png", $max_width,$max_height);</code> |
* Thay đổi kích thước theo tỉ lệ phần trăm: <code php>$image->resizePercent(200);</code> | * Thay đổi kích thước theo tỉ lệ phần trăm: <code php>$image->resizePercent(200);</code> |