当前位置:网站首页>Acquisition of wechat applet JSON for PHP background database transformation
Acquisition of wechat applet JSON for PHP background database transformation
2022-06-23 13:52:00 【qq_ forty-five million nine hundred and eleven thousand five hu】
php Code :
<?php
// $username = array();
// $password = array();
$userandpass = array();
include "con_mysql.php";
$conn = con_mysql("localhost", "root", "", "supermarket");
$sql = "SELECT username, password FROM sup_user;";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc()) // Get all the data in the table
{
$u_p = array();
// echo "username: ".$row['username']." password: ".$row["password"];
$u_p['username'] = $row['username'];
$u_p['password'] = $row['password'];
$userandpass[] = $u_p;
}
}
// $userandpass['username'] = $username;
// $userandpass['password'] = $password;
echo json_encode($userandpass);
?>
js Code :
// index.js
// Get application instance
const app = getApp()
Page({
data: {
t:"hwllo"
},
onLoad: function(){
var that = this;
wx.request(
{
url:"http://127.0.0.1/SM/select_alluser.php",
headers:{
'content-type':'application/json'
},
method:'GET',
success:res=>{
that.setData({
t:res.data
})
}
}
);
}
})
wxml Code :
<view wx:for="{
{t}}" wx:key="key">{
{
item.username}}</view>
<view wx:for="{
{t}}" wx:key="key">{
{
item.password}}</view>
Data returned in the background :

边栏推荐
- 2022软科大学专业排名出炉!西电AI专业排名超清北,南大蝉联全国第一 !
- IEEE transaction journal revision process record
- Digraph D and e
- Deci 和英特尔如何在 MLPerf 上实现高达 16.8 倍的吞吐量提升和 +1.74% 的准确性提升
- 父母-子女身高数据集的线性回归分析
- Building Intel devcloud
- Crmeb second open SMS function tutorial
- 前AMD芯片架构师吐槽,取消 K12 处理器项目是因为 AMD 怂了!
- Quickly understand the commonly used asymmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry
- Quartus II 13.1 detailed installation steps
猜你喜欢
随机推荐
What a talented company that can turn SAP system into a chicken rib!
How to solve the task cache compilation problem caused by gradle build cache
How deci and Intel can achieve up to 16.8x throughput improvement and +1.74% accuracy improvement on mlperf
Former amd chip architect roast said that the cancellation of K12 processor project was because amd counseled!
【深入理解TcaplusDB技术】 Tmonitor模块架构
Online text filter less than specified length tool
Androd Gradle模块依赖替换如何使用
Tencent cloud tdsql-c heavy upgrade, leading the cloud native database market in terms of performance
Digraph D and e
【深入理解TcaplusDB技术】一键安装Tmonitor后台
从类、API、框架三个层面学习如何设计可复用软件的学习心得
. Net how to use log framework NLog
通过 OpenVINO Model Server和 TensorFlow Serving简化部署
Configure SSH Remote Login for H3C switch
You call this shit MQ?
Js: get the maximum zindex (Z-index) value of the page
Monitor the cache update of Eureka client
理解ADT与OOP
Has aaig really awakened its AI personality after reading the global June issue (Part 1)? Which segment of NLP has the most social value? Get new ideas and inspiration ~
Overview of national parks in the United States









