In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to write interfaces for phpcms api. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.
How to write phpcms api interface?
Recently, I developed a crm system, thinking that if I can sell it in the future, can I dynamically call the recommended information of my website in the interface, which is regarded as an advertisement! So I tried to develop a simple api interface with phpcms
phpcms v9 development simple api interface (applicable to white!)
phpcms v9 api interfaces are stored in api folder, access path is www.XXX.com/api.php? op=count&....., The other op=count is for your specific api file, so I started developing according to this rule!
(1) Step 1: Create the file demo.php under the api folder of the website, code:
(2) Use Ajax to send requests on the request-side page
$(function(){$.ajax({url:'http://www.XXX.com/api.php? op=demo&catid=28&num= 10', dataType:'jsonp',//jsonp Typejsonp:"jsoncallback", //callback type:' get', success:function(data){var data=eval(data); //Convert to json object $.each(data, function(index, p){html = "";html += ""+ p.title +"";html += "";$("#test").append(html); //append to id=test div})},error : function() {console.log ('fail ');}});});});
OK done! This can have cross-domain call their own website inside things!
The effect browsing is as shown in the figure:
Thank you for reading! About phpcms api write interface method to share here, hope the above content can have some help to everyone, so that we can learn more knowledge. If you think the article is good, you can share it so that more people can see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.