Bạn có thể đi trước và thực hiện tất cả các phương pháp mới, hoặc chỉ chọn những người phù hợp với nhu cầu của bạn. Hãy bắt đầu bằng cách thêm một số cách thức mới để thiết lập ngày. Tài liệu tự động: Nếu bạn nhận xét mã của bạn bằng cách sử dụng định dạng PHPDoc, như mô tả trong Chương 2, | Simpo PDF Merge and Split Unregistered Version - http PHP OBJECT-ORIENTED SOLUTIONS while the default flags strip all characters with an ASCII value of less than 32 or greater than 127 special_chars FILTER_FLAG_STRIP_LOW FILTER_FLAG_STRIP_HIGH To set the values in or an .htaccess file use php_value followed by the directive and its value as a space-delimited list like this php_value special_chars php_value FILTER_FLAG_STRIP_LOW FILTER_FLAG_STRIP_HIGH Building the validation class In spite of the complexity of the filter functions the ability to filter or validate many variables in a single operation is a huge benefit. It means that you can use a custom class to build the multidimensional array that determines how each variable should be treated. Once the array has been built it s just a matter of passing it to the appropriate filter function and capturing the result. By encapsulating each stage of the process inside the class you end up with a validation tool that is easy to use but which leaves all the hard work to the filter functions. First of all let s consider what functionality the class should have. Deciding what the class will do Looking at the available filters in Tables 4-4 and 4-5 you can quickly come up with the following data types and formats the class should validate Integer Floating point number Boolean Email URL Match against a regular expression You also need to be able to strip HTML tags and convert special characters. Anything else The following tasks are commonly required when validating input Check that all required fields have a value Check for a numeric array Specify a minimum and maximum number of characters in text input 138 Simpo PDF Merge and Split Unregistered Version - http USING PHP FILTERS TO VALIDATE USER INPUT Finally you want a method that does nothing. No I haven t finally lost my senses. This simply adds an .