Call to a member function assign() on null
Thinkphp:
在子控制器里面写了一个构造函数,如下
//构造函数
public function __construct(){
echo 1;
}
结果页面报错了 ----> Call to a member function assign() on null

然后去继承的父类里面一看,原来里面写了一个_initialize()的方法,原来是子类的构造函数覆盖了父类的,所以报错了,所以需要继承一下父类的构造函数:
parent::__construct();
其实_initialize()是TP封装的方法,和PHP自带的__construct()方法是差不多一样的,不过有一点区别,那就是_initialize() 它会帮我们自己继承父类的构造函数,而__construct()源生自带的,需要自己去继承父类构造函数。
Call to a member function assign() on null的更多相关文章
- PHP Lumen Call to a member function connection() on null 报错
(1/1) Error Call to a member function connection() on nullin Model.php line 1201at Model::resolveCon ...
- Call to a member function allowField() on null 错误总结
Call to a member function allowField() on null 在空对象上调用 allowField() 没有该模型对象无法调用,需要创建相应的模型 错误版本: if ...
- 解决ThinkPHP Call to a member function assign() on a non-object
<ignore_js_op> assign是tp模板输出变量的一个方法.没有object只能说没实例化...<ignore_js_op> 经过几番思索,终于发现了.原来是Act ...
- Call to a member function assign() on a non-object;thinkphp中报错
这个在自己写的类中 需要function __construct(){parent::__construct();}继承父类构造函数 当发生这个错误的时候,需要在构造函数中集成父类构造
- 显示Class 'Think\Controller\FuController' not found和Call to a member function assign() on a non-object 的错误问题
Class 'Think\Controller\FuController' not found 错误位置 FILE: D:\wamp\www\tinkphp\Application\Come\Cont ...
- Wordpress 数据库查询错误 Call to a member function get_results() on null
在插件中的一个文件使用如下代码,无法查询 <body> <?php global $wpdb; $sql = ""; $sql = "SELECT * ...
- laravel和lumen数据库链接错误_FatalErrorException Call to a member function connection
FatalErrorException in Model.php line 3339: Call to a member function connection() on null 挺简单的一个lum ...
- Call to a member function cellExists() on a non-object /phpexcel/Classes/PHPExcel/Calculation.php on line 3241
PHP Fatal error: Call to a member function cellExists() on a non-object in /home/edata/eframework/we ...
- Thinkphp---------Call to a member function free_result() on a non-object
1.平时用框架用久了,直接执行原生的sql反而做起来反应迟钝了.今天遇到一个问题,就是直接执行一个添加的sql语句,然后我用了TP框架的M()->query();方法.运行以后,会报Call t ...
随机推荐
- Android-ListView-CursorAdapter
在上篇博客,Android-ListView-SimpleCursorAdapter,中介绍了SimpleCurosrAdapter的使用操作(SimpleCursorAdapter是简单便捷Curs ...
- ASP.NET Core2利用Jwt技术在服务端实现对客户端的身份认证
背景 在微服务架构下,一般都会按不同的业务或功能将整个系统切分成不同的独立子系统,再通过REST API或RPC进行通讯并相互调用,形成各个子系统之间的串联结构.在这里,我们将采用REST API的通 ...
- Shapefile点图层转换为Shapefile线图层
在Oracle数据表转换为Shapefile(一)和Oracle数据表转换为Shapefile(二)两篇文章中,分别介绍了两种不同的根据Oracle数据表生成Shapefile点图层的方法.本文在此基 ...
- [LeetCode 题解]: Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...
- 使用SQL Delta.v5.1.1.98.破解版同步数据结构
概述 本篇文章主要介绍SQL DELTA的简单使用.为了能够更加明了的说明其功能,本文将通过实际项目中的案例加以介绍. 1. SQLDELTA简介 SQLDELTA是一款便捷实用的数据库管理工具.使用 ...
- 忘记Oracle用户名和密码
方法一: 看看是不是Oracle服务器没有打开 打开cmd,输入sqlplus /nolog,回车---->进入sqlplus; 输入“conn /as sysdba”:以超级管理员的方式连接数 ...
- “全栈2019”Java第四十八章:重写方法Override
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- UIButton的探秘
原文链接 sizeToFit()和sizeThatFits(_:) sizeToFit()会调用sizeThatFits(_:)方法,将现在的frame作为参数.然后根据函数返回的结果更新view. ...
- 性能分析工具VisualVM for eclipse安装过程总结
Java VisualVM Java VisualVM is a tool that provides a visual interface for viewing detailed informat ...
- flink学习笔记:DataSream API
本文为<Flink大数据项目实战>学习笔记,想通过视频系统学习Flink这个最火爆的大数据计算框架的同学,推荐学习课程: Flink大数据项目实战:http://t.cn/EJtKhaz ...