thinkphp操作mysql json字段


    /**
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    function test() {

        // 查询
        $ret = Db::name('json')->where('fvalue->name', 'lobtao')->select();
        var_dump($ret);
        // 修改
        $ret = Db::name('json')->where('fvalue->name', 'lobtao')->update([
            'fvalue->name' => '深圳',
        ]);
        var_dump($ret);
        $ret = Db::name('json')->select();
        var_dump($ret);

    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM