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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.
