-
Json_encode problem under thinkphp5
I set up User.php, User.php under the model layer and have a method getUserInfo to query the data, as follows:
$userModel = new UserModel;
dump($userModel->getUser());
dump(json_encode($userModel->getUser()));
the first printed data is as follo...
-
Model events such as TP5.0 before_insert are invalid?
follow the ThinkPHP5.0 official manual prompt:
User::event( before_insert , function ($user) {
if ($user->status != 1) {
return false;
}
});
:https: www.kancloud.cn manua...
TP beforeInsert ,,,,.
the direct insertion is s...
-
Consult about the problem of belongsTo association in thinkphp5
situation description: A Table: user s coupon Information Table, Field: id,ticket_id,status B Table: voucher Information Table, Field: id,ticket_info,status in Model A, there is the following code: class An extend Model { public function getUserTi...
-
How does the thinkphp5 template volist parse variables?
Please take a look. Is it wrong to write this? why can t you parse this variable ?
...
-
The browser reported an error Access denied for user 'root'@'localhost' (using password:NO
browser error: SQLSTATE [HY000] [1045] Access denied for user root @ localhost (using password: NO) I successfully connected to the database with navicat, the user name is root, password is the password set when installing mysql, and the framework...
-
TP5 detects login jump in behavior class, and redirect reports an error
check whether to log in in the check class file under the behavior file under the module, and then jump to the business, use the redirect prompt to report an error, and find the answer
Call to undefined method app admin behavior CheckBehavior::redir...
-
How to understand the application public files in thinkphp5?
all controllers of my background module admin, need operation authentication, or build operation menus, or other common operations
on the premise of ignoring the intermediate key:
my previous way of writing is to write a "master " controller common...
-
Realize the if judgment of where of mysql
how to realize the if judgment of mysql. There is now a table with two key fields SELECT * FROM house WHERE price= 8500 OR shoufu= 30 I think, when the $price passed in by php is empty, the sql search statement is SELECT * FROM house WHERE s...
-
Why does thinkphp5 always report an error when uploading multiple files using the multiple attribute?
Why does thinkphp5 always report errors when uploading multiple files using the multiple attribute?
error message:
HTML Code:
<input name="file" type="file" multiple >
<input type="submit" value=""...
-
Thinkphp5.1 $this- > request- > isPost () question
$this- > request- > isPost () uses $.post (target, query) .success (function (data) { in receiving empty data to report the following error
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version....
-
Thinkphp5.0 cannot receive the data sent by the post request?
A simple post request, which was normal before, suddenly went wrong. As thinkphp5.0 is not very familiar with it, it should not be a big problem. I hope you will pass by and have a look.
WeChat Mini Programs client sends post request code, which does...
-
Thinkphp Redis problem
think-queue; is used in TP5, but when enabled, the Redis extension is not installed! but my extension does have
I don t know why? Solve it! there s nothing wrong with the environment variable!
...
-
Multiple top-level domain names of tp5 are bound to different modules.
for business reasons, you need to bind different modules to different domain names in the tp5 framework.
now, for example, www.test.com has entered the index controller index method in the hkfc module. but the second * .test.com does not work, for ...
-
Questions about swoole sessions
var token = localStorage.getItem( userToken );
if(!token){
alert( );
return false;
}
var ws = new WebSocket("ws: 127.0.0.1:8081");
when ws.onopen, I intend to send token to the server for verification, but it...
-
TP5 field () method fields are not displayed
TP5 model queries with the field () method have a field that does not display
Commodity table model
**
*
*
* @return think model relation HasMany
*
public function goodsComment() {
return $this->hasMany( Ma...
-
Tp5 ajax value transfer problem
foreground code
$.ajax({
type: POST ,
url: __URL__ add ,
data:{content:data}
});
data is an array
$data $_REQUEST
ajax
...
-
Thinkphp5.0 cannot use think-queue package, php think queue:work command does not exist
recently used the queue, used the official queue package top-think think-queue , successfully wrote the data into the queue after installation, but went to the consumption queue, that is, when using php think queue:work-- queue xxx, prompted that the c...
-
Interaction between php model and controller
learn to use Tp5.1
when looking at other people s code, I think a lot of operations about the database are written into the controller;
public function save()
{
$data = input( post );
$validate = $this->validate($data,"app commo...
-
Problems with Custom Verification in Tp5
for example, the array is like this
$data = [
[
mobile => 1 ,
price => 100.00
],
[
mobile => 2 ,
price => 500.00
],
];
one-dimensional array can be verified di...
-
Thinkphp5.0.5 uses carbon
I installed carbon, with composer and got an error when using it: fatal error: Class CarbonCarbon not found
I installed it using composer require nesbot carbon. The directory structure after installation is as follows:
Do you want to set some...