thinkphp/SAE/数据库操作/D方法 问题
本地的数据库中本来有一个mesg表,后来在这个表后面增加了一个字段maid。
在某个操作中使用
$mesg = D('Mesg');
dump($mesg);
模型里有:
protected $_map = array(
'user'=>'muser',
'content'=>'mcontent',
'time'=>'mtime',
'aid'=>'maid',
);
结果中有这个:
["fields:protected"] => array(8) {
[0] => string(3) "mid"
[1] => string(4) "muid"
[2] => string(5) "muser"
[3] => string(8) "mcontent"
[4] => string(5) "mtime"
[5] => string(4) "maid"//这个
["_autoinc"] => bool(true)
["_pk"] => string(3) "mid"
}
在本地里面是有maid字段的。
但是上传到sinaapp上面的时候,还是同样的操作,结果却是:
["fields":protected] => array(7) {
[0] => string(3) "mid"
[1] => string(4) "muid"
[2] => string(5) "muser"
[3] => string(8) "mcontent"
[4] => string(5) "mtime"
["_autoinc"] => bool(true)
["_pk"] => string(3) "mid"
}
而下面这个无论在本地还是sae上都是正常的:
["_map":protected] => array(4) {
["user"] => string(5) "muser"
["content"] => string(8) "mcontent"
["time"] => string(5) "mtime"
["aid"] => string(4) "maid"
}
本来sae上面的table也是没有那个字段的,后来增加了字段无效,我把所有表重新传上去也无效。
runtime删了很多次也是无效,不知道是什么原因造成的?
回复讨论(解决方案)
先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目
先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目
sae表结构是已经修改好的。
“待本地以sae方式调试成功”是什么意思?
先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目
我现在新建的第二个版本,然后把第一个版本的全部copy过去,然后就好了!!
谢谢!
但是我想知道是什么原因造成的?
在你的机器上你不是用 sae 方式调试的吗?
常规的项目入口文件
require './ThinkPHP/ThinkPHP.php';
SAE的项目入口文件
require './ThinkPHP/Extend/Engine/Sae.php';
先确认 sae 端的表结构已经修改成功
待本地以 sae 方式调试成功后,重新提交整个项目
还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。
在你的机器上你不是用 sae 方式调试的吗?
常规的项目入口文件
require './ThinkPHP/ThinkPHP.php';
SAE的项目入口文件
require './ThinkPHP/Extend/Engine/Sae.php';
嗯,这个明白了
还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。 你不是用 SVN 软件的吗?
在项目目录上右键-提交即可
引用 5 楼 的回复:
还有我想问如果不弄第二个版本,怎样将第一个版本整个重新提交?
我不知道应该怎么重新提交。
你不是用 SVN 软件的吗?
在项目目录上右键-提交即可
那样提交之后就是没有作用,还是一样有那个问题。
但是我重建一个版本问题就解决了。
不知道为什么。
我也遇到这个问题了。网上搜了下,说是KVDB缓存的问题。然后我禁用KVDB,重新开启,但还是出现这个情况。经过一番折腾才知道禁用KVDB并没有清空缓存,虽然禁用的时候也提示了,但是至少我的没有被清空,原因就不去纠结了。
你可以用下面的代码来查看你的KVDB的缓存内容
[code]$kv = new SaeKV();
$ret = $kv->init();
$ret = $kv->pkrget('', 100);
dump($ret);
[/code]
如果你禁用并重新开启KVDB后,运行上面代码仍然输出缓存内容,那说明KVDB的缓存还在。
复制下面的代码,执行后解决一切问题。
[code] $kv = new SaeKV(); //创建SaeKV对象
$ret = $kv->init(); //初始化
$ret = $kv->pkrget('', 100); //获取缓存内容(帮助文档注明了上限为100条)
$this->show('
当前KVDB缓存内容
');dump($ret);
//遍历并删除
foreach ($ret as $key => $value) {
$ret = $kv->delete($key);
}
$this->show('
');
$this->show('
清空KVDB缓存后的内容
');$ret = $kv->pkrget('', 100);
dump($ret);
if (!$ret){
$this->show('
');
$this->show('KVDB清空成功');
};
[/code]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov
