Filter Functions

一些實用的 filter functions ,某些地方可以取代 regex 驗證

  1. filter_has_var — Checks if variable of specified type exists
  2. filter_id — Returns the filter ID belonging to a named filter
  3. filter_input_array — Gets external variables and optionally filters them
  4. filter_input — Gets a specific external variable by name and optionally filters it
  5. filter_list — Returns a list of all supported filters
  6. filter_var_array — Gets multiple variables and optionally filters them
  7. filter_var — Filters a variable with a specified filter

今天才知道這個東西,以後如果有機會要驗證表單的話,很多常用的欄位都不需自己再寫 regex 了(詳見官方文件)。

Posted in Programming

Leave a Reply

Your email address will not be published.