EventConfig::requireFeatures
(PECL event >= 1.2.6-beta)
EventConfig::requireFeatures — 輸入應用程式要求的必需 event 方法功能
說明
   public
   EventConfig::requireFeatures(
    int
     
  $feature
   ): bool輸入應用程式要求的必需 event 方法功能。
參數
- 
     feature
- 
     所需功能的位掩碼。參考 EventConfig::FEATURE_*常量
返回值
   成功時返回 true, 或者在失敗時返回 false。
  
範例
示例 #1 EventConfig::requireFeatures() 示例
<?php
$cfg = new EventConfig();
// 建立跟 config 關聯的 event_base
$base = new EventBase($cfg);
// 需要 FDS 功能
if ($cfg->requireFeatures(EventConfig::FEATURE_FDS)) {
    echo "現在需要 FDS 功能\n";
    $base = new EventBase($cfg);
    ($base->getFeatures() & EventConfig::FEATURE_FDS)
        and print("FDS - 任意檔案描述符型別,不僅僅是 socket \n");
}
?>
以上例程的輸出類似於:
現在需要 FDS 功能 FDS - 任意檔案描述符型別,不僅僅是 socket
參見
- EventBase::getFeatures() - Returns bitmask of features supported