当前位置:网站首页>Phpcms V9 mobile phone access computer station one-to-one jump to the corresponding mobile phone station page plug-in
Phpcms V9 mobile phone access computer station one-to-one jump to the corresponding mobile phone station page plug-in
2022-06-26 09:02:00 【CMS applet plug-in [official]】
There are many jump codes on the Internet , Some jump to different templates through the controller , Some are through js Jump , But there is a characteristic that it can not be realized ,pc and wap One to one jump of the page , It's a hole , I have been trying to solve this problem , I didn't think of a good method until today :
First of all : First, introduce a local site in the public header api file :jumpwap.php
- <script language="JavaScript" src="{APP_PATH}api.php?op=jumpwap&id={$id}&catid={$catid}&page={$page}"></script>
Parametric analysis :
id Represents the id, The list page and the first page are empty
catid The column id, If it is blank, it means the home page
page Pagination , If pc The paging of the mobile station is inconsistent with that of the mobile station , It is recommended to remove this parameter , Otherwise, it may cause paging errors
The second part : In the head head Add inside js Code , It is best to follow the first step of the code ,
- <script type="text/javascript">
- var userAgentInfo = navigator.userAgent;
- var wapurl = $('meta[name="wapurl"]').attr("content");
- if (userAgentInfo.indexOf("Android") > 0 || userAgentInfo.indexOf("iPhone") > 0 || userAgentInfo.indexOf("SymbianOS") > 0 || userAgentInfo.indexOf("Windows Phone") > 0 || userAgentInfo.indexOf("iPod") > 0 || userAgentInfo.indexOf("iPad") > 0)
- {
- if(wapurl){
- window.location.href = wapurl;
- }else{
- window.location.href = "http://m.pweb123.com/index.php";
- }
- }
- </script>
The third step : Development jumpwap.php file
Part of the code :
In this way, you can realize the one-to-one jump of the mobile computer website page , Whether static or not, jump can be realized ,
To refuse to reach out to the party , The code is not open source for the time being , If you think it works for you , You can reward me , It doesn't matter how much , Respect the fruits of labor , It's not easy , Understand more !
边栏推荐
- Leetcode: array fast and slow pointer method
- Fast construction of neural network
- Regular Expression 正则表达式
- pgsql_ UDF01_ jx
- Checkerboard generation + camera calibration + stereo matching
- 基于SSM的毕业论文管理系统
- 直播回顾 | smardaten李鸿飞解读中国低/无代码行业研究报告:风向变了
- docker安装redis
- Yolov5 advanced 4 train your own data set
- Install Anaconda + NVIDIA graphics card driver + pytorch under win10_ gpu
猜你喜欢
随机推荐
MPC learning notes (I): push MPC formula manually
1.17 daily improvement of winter vacation learning (frequency school and Bayesian school) and maximum likelihood estimation
[QNX Hypervisor 2.2用户手册]12.2 术语(二)
Euler function: find the number of numbers less than or equal to N and coprime with n
ROS learning notes (6) -- function package encapsulated into Library and called
phpcms小程序插件教程网站正式上线
Solution to the encoding problem encountered by the crawler when requesting get/post
phpcms小程序插件api接口升级到4.3(新增批量获取接口、搜索接口等)
Summary of common instructions for arm assembly
Sqoop merge usage
Yolov5进阶之四训练自己的数据集
Yolov5 advanced camera real-time acquisition and recognition
PD快充磁吸移动电源方案
Yolov5进阶之一摄像头实时采集识别
Pytorch build progression
Regular Expression 正则表达式
Structure diagram of target detection network
Section IV HQL execution process
力扣399【除法求值】【并查集】
基于SSM的电脑商城









