当前位置:网站首页>Xunrui CMS custom data interface PHP executable code
Xunrui CMS custom data interface PHP executable code
2022-06-22 20:47:00 【Blue dream Maple Creek】

When the interface of the system itself Not meeting your needs when , You can customize the interface and the server code here ( This type requires php Development experience ).
Usage example
Query all users , And back to username and email data
1、 Definition test.php Interface file :./dayrui/App/Httpapi/Api/test.php
<?php/** * api Sample file * A variable is introduced * $return Represents the standard return variable */$return = []; // Return the data // Query all members , And back to username and email$data = \Phpcmf\Service::M()->table('member')->getAll();if ($data) { foreach ($data as $r) { $return[] = [ 'id' => $r['id'], 'username' => $r['username'], ]; }}Write your... Here php Code , Query statement , Submit statements, etc .
It can also be written like this :
\Phpcmf\Service::C()->_json(1, ' My return script succeeded ', [' Returns an array of ']); // Successful writing \Phpcmf\Service::C()->_json(0, ' My return script failed '); // Failure is written in 2、 Background selection test.php file

3、 When testing the request result , The return format is :
array(3) { ["code"]=> int(1) ["msg"]=> string(2) "ok" ["data"]=> array(13) { [0]=> array(2) { ["id"]=> string(1) "1" ["username"]=> string(5) "admin" } ......This type Yes php The skill requirements are relatively high , If you encounter an execution error, you can Error log Examination result .
边栏推荐
猜你喜欢

Three months of self-taught automatic test, salary from 4.5K to 15K, who knows what I have experienced?

MySQL基础——函数

智能计算之神经网络(Hopfield网络-DHNN,CHNN )介绍

Easydss problem and solution summary
Code to Image Converter | 代码生成漂亮图片工具

An IPFs enabled email - skiff

软件压力测试有哪些方法,如何选择软件压力测试机构?

Security policy and NAT (easy IP) of firewall Foundation

Ribbon负载均衡
MySQL中如何计算同比和环比
随机推荐
播放增长900w,B站用户叫好叫座的恰饭总结
[in depth understanding of tcapulusdb technology] business guide for creating doc acceptance
leetcode.11 --- 盛最多水的容器
It supports running in kubernetes, adds multiple connectors, and seatunnel version 2.1.2 is officially released!
讲真,Kotlin 协程的挂起没那么神秘(原理篇)
他98年的,我玩不过他...
[proteus simulation] 8x8LED dot matrix digital cyclic display
74-这类SQL优化,oracle输给了mysql,如何补救?
MySQL基础——约束
Using span method to realize row merging of multi-layer table data
71-对2010年阿里一道Oracle DBA面试题目的分析
完全背包如何考虑排列问题
元宇宙中的云计算,提升你的数字体验
[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance
Possible security vulnerabilities in NFT
Lora technology -- Lora signal changes from data to Lora spread spectrum signal, and then from RF signal to data through demodulation
86-给参加&lt;SQL写法与改写培训&gt;的学员补充一个二手案例
智能计算之神经网络(Hopfield网络-DHNN,CHNN )介绍
【Proteus仿真】8x8Led点阵数字循环显示
【Proteus仿真】三极管组成的H桥驱动直流电机+按键正反转控制