PHP 中的 interface_exists()函数

首页 / PHP入门教程 / PHP 中的 interface_exists()函数

interface_exists() - 语法

interface_exists ( $interface_name [, $autoload] );

此函数检查是否定义了给定的接口。

Sr.No Parameter & Description
1

interface_name(必需)

接口名称

2

autoload(可选)

无涯教程网

默认情况下是否调用_autoload。

interface_exists() - 返回值

如果定义了interface_name给定的接口,则返回true,否则返回false。

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-interface-exists.html

来源:LearnFk无涯教程网

interface_exists() - 示例

<?php
   if (interface_exists('SomeInterface')) {
      class MyClass implements SomeInterface {
         //Methods
      }
   }
?> 

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

Node.js开发实战 -〔杨浩〕

DevOps实战笔记 -〔石雪峰〕

架构实战案例解析 -〔王庆友〕

NLP实战高手课 -〔王然〕

检索技术核心20讲 -〔陈东〕

实用密码学 -〔范学雷〕

Python自动化办公实战课 -〔尹会生〕

爆款文案修炼手册 -〔乐剑峰〕

AI大模型系统实战 -〔Tyler〕

好记忆不如烂笔头。留下您的足迹吧 :)