💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## Exception异常对象转换为字符串显示 > 方法:exception_to_str(\Exception $e): string 参数: | 参数 | 类型 | 必须 | 说明 | | --- | --- | --- | --- | | `$e` | \Exception | 是 | 待转换的异常对象 | 返回值:string 类型 > 示例: ```php try{ throw new \Exception("测试异常"); }catch (\Exception $e){ var_dump(exception_to_str($e)); } ``` 输出结果: ``` Exception 测试异常 in C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\application\demo\controller\Index.php:14 Stack trace: #0 [internal function]: app\demo\controller\Index->welcome() #1 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\Container.php(395): ReflectionMethod->invokeArgs(Object(app\demo\controller\Index), Array) #2 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\route\dispatch\Module.php(131): think\Container->invokeReflectMethod(Object(app\demo\controller\Index), Object(ReflectionMethod), Array) #3 [internal function]: think\route\dispatch\Module->think\route\dispatch\{closure}(Object(think\Request), Object(Closure), NULL) #4 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\Middleware.php(185): call_user_func_array(Object(Closure), Array) #5 [internal function]: think\Middleware->think\{closure}(Object(think\Request)) #6 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\Middleware.php(130): call_user_func(Object(Closure), Object(think\Request)) #7 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\route\dispatch\Module.php(136): think\Middleware->dispatch(Object(think\Request), 'controller') #8 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\route\Dispatch.php(168): think\route\dispatch\Module->exec() #9 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\App.php(432): think\route\Dispatch->run() #10 [internal function]: think\App->think\{closure}(Object(think\Request), Object(Closure), NULL) #11 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\Middleware.php(185): call_user_func_array(Object(Closure), Array) #12 [internal function]: think\Middleware->think\{closure}(Object(think\Request)) #13 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\Middleware.php(130): call_user_func(Object(Closure), Object(think\Request)) #14 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\thinkphp\library\think\App.php(435): think\Middleware->dispatch(Object(think\Request)) #15 C:\www\project_yunj_admin_universal_inster\yunj_admin_universal_interior\public\index.php(21): think\App->run() #16 {main} ```