site_status_test_php_modules
云策文档标注
概述
本文档介绍了 WordPress 中的 site_status_test_php_modules 过滤器,用于修改测试 PHP 模块的数组。该过滤器在 WP_Site_Health 类中用于检查主机是否安装了必需的 PHP 模块。
关键要点
- 过滤器名称:site_status_test_php_modules
- 用途:过滤表示要测试的所有模块的数组
- 参数:$modules 是一个关联数组,包含要测试的模块及其属性
- 模块属性:包括 function、extension、constant、class、required 和 fallback_for,其中 function 或 extension 必须至少提供一个
- 相关函数:WP_Site_Health::get_test_php_extensions() 使用此过滤器
- 版本历史:在 WordPress 5.2.0 中引入,5.3.0 添加了 $constant 和 $class 参数
代码示例
$modules = apply_filters( 'site_status_test_php_modules', $modules );
原文内容
Filters the array representing all the modules we wish to test for.
Parameters
$modulesarray- An associative array of modules to test for.
...$0arrayAn associative array of module properties used during testing.
One of either$functionor$extensionmust be provided, or they will fail by default.functionstringOptional. A function name to test for the existence of.extensionstringOptional. An extension to check if is loaded in PHP.constantstringOptional. A constant name to check for to verify an extension exists.classstringOptional. A class name to check for to verify an extension exists.requiredboolIs this a required feature or not.fallback_forstringOptional. The module this module replaces as a fallback.
Source
$modules = apply_filters( 'site_status_test_php_modules', $modules );Changelog
User Contributed Notes
You must log in before being able to contribute a note or feedback.