ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
instanceof 用于**确定一个 PHP 变量是否属于某一类**class 的实例: instanceof 也可用来**确定一个变量是不是继承自某一父类的子类的实例**: 检查一个对象是否 不是 某个类的实例,可以使用 逻辑运算符 not 。 虽然 instanceof 通常直接与类名一起使用,但也可以使用对象或字符串变量: 如果被检测的变量不是对象,instanceof 并不发出任何错误信息而是返回 false 。 ``` ~~~ think\exception\ErrorException {#141 ▼ #severity: 2 #data: [] #message: "Division by zero" #code: 0 #file: "D:\project\wttree\wttree\app\Test\controller\TestEx.php" #line: 25 trace: {▼ D:\project\wttree\wttree\app\Test\controller\TestEx.php:25 {▼ app\test\controller\TestEx->index() … › try {\r › return(1/0);\r › } catch (\Throwable $e) {\r arguments: {▶} } app\test\controller\TestEx->index() {} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Container.php:344 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\route\dispatch\Controller.php:110 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:59 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:66 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\route\dispatch\Controller.php:113 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\route\Dispatch.php:90 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Route.php:772 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:59 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:66 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Route.php:773 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Http.php:216 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Http.php:206 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:59 {▶} D:\project\wttree\wttree\vendor\topthink\think-multi-app\src\MultiApp.php:71 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:59 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:66 {▶} D:\project\wttree\wttree\vendor\topthink\think-multi-app\src\MultiApp.php:72 {▶} think\app\MultiApp->handle() {} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Middleware.php:142 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:85 {▶} D:\project\wttree\wttree\vendor\thans\tp-jwt-auth\src\middleware\InjectJwt.php:14 {▶} thans\jwt\middleware\InjectJwt->handle() {} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Middleware.php:142 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:85 {▶} D:\project\wttree\wttree\vendor\topthink\think-trace\src\TraceDebug.php:71 {▶} think\trace\TraceDebug->handle() {} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Middleware.php:142 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:85 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Pipeline.php:66 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Http.php:207 {▶} D:\project\wttree\wttree\vendor\topthink\framework\src\think\Http.php:170 {▶} D:\project\wttree\wttree\public\index.php:29 {▶} } } ~~~ ```