Call to a member function allowField() on null

在空对象上调用  allowField()

没有该模型对象无法调用,需要创建相应的模型

错误版本:

if ($this->$model->allowField(true)->isUpdate($isUpdate)->save($data) !== false) {

修改版本:

判断没有该模型就创建

$model = $this->model;
if (empty($model)) {
$model = new CorpModel;
}
if ($model->allowField(true)->isUpdate($isUpdate)->save($data) !== false) {

Call to a member function allowField() on null 错误总结的更多相关文章

  1. 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 ...

  2. Call to a member function assign() on null

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

  3. Call to a member function select() on string错误

    Call to a member function select() on string错误 Call to a member function select() on array错误 我也是 Get ...

  4. Wordpress 数据库查询错误 Call to a member function get_results() on null

    在插件中的一个文件使用如下代码,无法查询 <body> <?php global $wpdb; $sql = ""; $sql = "SELECT * ...

  5. laravel和lumen数据库链接错误_FatalErrorException Call to a member function connection

    FatalErrorException in Model.php line 3339: Call to a member function connection() on null 挺简单的一个lum ...

  6. 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 ...

  7. Thinkphp---------Call to a member function free_result() on a non-object

    1.平时用框架用久了,直接执行原生的sql反而做起来反应迟钝了.今天遇到一个问题,就是直接执行一个添加的sql语句,然后我用了TP框架的M()->query();方法.运行以后,会报Call t ...

  8. :( Call to a member function Table() on a non-object 错误位置

    :( Call to a member function Table() on a non-object 错误位置 $Model不是模板,是你自己先前链接数据库返回的对象...我的是改为$Form

  9. Fatal error: Call to a member function bind_param() on a non-object in

    今天在练习 mysql是出现错误:   Fatal error: Call to a member function bind_param() on a non-object in 解决步骤: 1. ...

随机推荐

  1. Software Testing Techniques Homework 3

    1. a.This is the chart b. initial numPrimes = 4, t1 would over the loop. c. t = ( n = 1) d. node cov ...

  2. c# datarow[] 转换成 datatable, List<T> 转datatable

      c# datarow[] 转换成 datatable, List<T> 转datatable DdataRow[]转成Datatable private DataTable ToDat ...

  3. aspnetcore 认证相关类简要说明二

    能过<aspnetcore 认证相关类简要说明一>我们已经了解如何将AuthenticationOptions注入到我们依赖注入系统.接下来,我们将了解一下IAuthenticationS ...

  4. 打通版微社区(6):部署微信插件及开通QQ云服务

    写在前面: 此文是我最后写的.其实实际部署的时候,我是先安装了论坛并试图开通微信的微社区.发现微社区需要在微信公众平台的开发者中心里配置 "网页账号,网页授权获取用户基本信息"为论 ...

  5. 用POP动画模拟真实秒钟摆动效果

    用POP动画模拟真实秒钟摆动效果 静态图: 动画图: 此处用到了POP中的Spring系列动画,现提供源码如下: SecondClockView.h 与 SecondClockView.m // // ...

  6. Python实例---抽屉热搜榜前端代码分析

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. Python 及其基础语法

    重新开始玩 Python,打算就是学完实验楼的"Python3 简明教程",然后就可以玩点小项目,先前学了点 Python2 就不管它啦. 以上. 认识 Python Python ...

  8. Io性能分析

    一.iostat使用说明 1.命令使用方法 使用ixstat –x 1 可以每隔1秒钟采集所有设备的io信息.其中的1类似于使用“vmstat  1”后面的1. 2.命令格式说明 ―――――――――― ...

  9. java构造方法-this关键字的用法

    public class constructor { public static void main(String[] args) { // TODO Auto-generated method st ...

  10. python 爬虫部分解释

    example:self.file = www.baidu.com存有baidu站的index.html def parseAndGetLinks(self): # parse HTML, save ...