Danh mục: PHP

Selenium WebDriver & Unit Testing trên Window
Selenium WebDriver hỗ trợ các phương thức can thiệp DOM HTML để thực hiện các thao tác tự động trên trình duyệt. Đối với các tính năng test cơ bản trên web/ blog, Selenium hỗ trợ tester thực hiện các test point, test case kiểm thử các phương thức hoạt động trên site nhằm bảo…

Sample code for a RESTful API constructed using WordPress
Here’s an example of a RESTful API built with WordPress that implements token-based authentication for the four main HTTP methods (POST, GET, PUT, DELETE): <?php class Sample_REST_API { /** * Endpoint namespace. * * @var string */ protected $namespace = ‘sample/v1’; /** * Route name. * * @var string */ protected $route = ‘/data’; /**…

Sample code in PHP checks the size of a folder by path, then deletes
Sample code in PHP checks the size of a folder by path, then deletes all files when the size reaches the limit specified as a percentage of disk space. Create the PHP script located at /path/to/your/script.php <?php $path = ‘/path/to/cache_folder’; $limit = 90; // percentage of disk space function get_dir_size($path) { $total_size = 0; $files…