thinkphp报错Call to undefined method app\index\controller\Index::fetch()

简介: thinkphp报错Call to undefined method app\index\controller\Index::fetch()

因为要写一个系统,所以又重新下载了thinkphp,然后安装了一下。回忆起这个问题很容易让新手朋友费解。会出现如下报错:Call to undefined method app\index\controller\Index::fetch()


其实就是没找到fetch属性,其实默认是有这个属性的。只是你没有使用罢了。


使用Controller继承一下就行了:

<?php
namespace app\index\controller;
use think\Controller;
class Index extends Controller
{
    public function index(){
        return $this->fetch('index');
    }
}


相关文章
|
1月前
【Azure Logic App】使用Outlook.com发送邮件遇到429报错
【Azure Logic App】使用Outlook.com发送邮件遇到429报错
|
1月前
|
开发工具 git
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
|
1月前
|
开发框架 .NET Windows
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
|
1月前
|
XML 数据格式
【Azure Logic App】在Logic App中使用 Transfer XML组件遇见错误 undefined
【Azure Logic App】在Logic App中使用 Transfer XML组件遇见错误 undefined
|
1月前
|
缓存
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
|
1月前
|
JavaScript API
Vue3 运行可以,build 打包发布报错,app.config.globalProperties 用法坑
Vue3 运行可以,build 打包发布报错,app.config.globalProperties 用法坑
36 2
|
1月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
94 2
|
1月前
|
开发工具 Android开发
上架Google Play报错:For new apps, Android App Bundles must be signed with an RSA key.
上架Google Play报错:For new apps, Android App Bundles must be signed with an RSA key.
83 1
|
1月前
|
安全 前端开发 网络安全
【Azure App Service】访问App Service应用报错 SSL: WRONG_VERSION_NUMBER
【Azure App Service】访问App Service应用报错 SSL: WRONG_VERSION_NUMBER
|
1月前
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.