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. 效果CSS实现三角

      <view class="hd"></view>.hd {   content: "";   height: 16rpx;   wi ...

  2. APACHE如何一个站点绑定多个域名?

    大家肯定遇到过这样的情况,需要APACHE2里一个站点绑定多个域名,那么如何操作呢?用ServerAlias 以前很笨,要使多个域名指向同一站点总是这样写: ServerAdmin admin@dom ...

  3. 有关平台支持的从经典部署模型到 Azure Resource Manager 的迁移的技术深入探讨

    本文将深入探讨如何从 Azure 经典部署模型迁移到 Azure Resource Manager 部署模型. 本文将介绍资源和功能级别的资源,让用户了解 Azure 平台如何在两种部署模型之间迁移资 ...

  4. .net core系列之《将.net core应用部署到Ubuntu》

    1.首先准备一个演示项目. 2.然后将这个项目用FileZilla工具上传到Ubuntu中. 3.进入目标文件,接下来有两种方法来部署项目 a.用dotnet run命令 root@hhz-virtu ...

  5. rabbitmq集群配置

    原文地址:http://www.360doc.com/content/14/0911/17/15077656_408713893.shtml 按照文章中的方式成功建立了两台机器的集群. 但文章中加入集 ...

  6. PG数据库空间大小及数据库对象占用空间大小

    select pg_size_pretty(pg_database_size('lrisk')); --查询数据库剩余空间 select pg_database.datname,pg_size_pre ...

  7. Try-Catch真的会影响程序性能吗

    很多帖子都分析过Try-Catch的机制,以及其对性能的影响. 但是并没有证据证明,Try-Catch过于损耗了系统的性能,尤其是在托管环境下.记得园子里有位网友使用StopWatch分析过Try-C ...

  8. oracle的乐观锁和悲观锁

    一.问题引出 1. 假设当当网上用户下单买了本书,这时数据库中有条订单号为001的订单,其中有个status字段是’有效’,表示该订单是有效的: 2. 后台管理人员查询到这条001的订单,并且看到状态 ...

  9. [翻译] DZNSegmentedControl

    DZNSegmentedControl A drop-in replacement for UISegmentedControl for showing counts, to be used typi ...

  10. haproxy开启日志功能

    haproxy在默认情况不会记录日志,除了在haproxy.conf中的global段指定日志的输出外,还需要配置系统日志的配置文件.下面以centos6.4为例,haproxy使用系统自带的rpm报 ...