Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何基于编码为QR码的URL与wordpress插件交互_Php_Wordpress_Url_Plugins - Fatal编程技术网

Php 如何基于编码为QR码的URL与wordpress插件交互

Php 如何基于编码为QR码的URL与wordpress插件交互,php,wordpress,url,plugins,Php,Wordpress,Url,Plugins,我正在尝试使用二维码,我的网站上每一个拥有账号的用户在注册时都会得到二维码。扫描时,此二维码将重定向到一个URL,然后我希望与Wordpress上的活动插件进行交互 我需要执行此代码,以完成扫描二维码时需要执行的操作。 PHP如下所示: mycred_add( 'Attended event.', $user_id, -1, '1 deducted for attending event, QR code scan.' ); 我是一名完全网络开发新手。我有中级Java和VBA的背景 我已经做到

我正在尝试使用二维码,我的网站上每一个拥有账号的用户在注册时都会得到二维码。扫描时,此二维码将重定向到一个URL,然后我希望与Wordpress上的活动插件进行交互

我需要执行此代码,以完成扫描二维码时需要执行的操作。 PHP如下所示:

mycred_add( 'Attended event.', $user_id, -1, '1 deducted for attending event, QR code scan.' );
我是一名完全网络开发新手。我有中级Java和VBA的背景

我已经做到了:我能够准确地为任何URL生成二维码,我的用户也可以购买积分。最后一步是找出plugin命令的URL。 我的插件是myCred.me 它有一个远程API

就董事会的规则而言,任何实现这一目标的方向都是值得赞赏的,我并不是要求提供替代品、产品或任何类似的建议。 只是,在编程方面,我应该如何设置它。

例如,我应该将PHP脚本嵌入到从链接本身读取$user变量的网页中,还是沿着这些行

自定义页面的QRcode url示例:

http://www.anysite.com/mycredapi.php?action=setpoints&userid=5
php函数:

function set_mycred_points($user_id) {
   mycred_add( 'Attended event.', $user_id, -1, '1 deducted for attending event, QR code scan.' );
}

if(isset($_GET['action']) && $_GET['action'] == 'setpoints' && isset($_GET['userid'])) {
   set_mycred_points($_GET['userid'])
}

请注意,我将包含一个密钥作为附加参数,并对参数进行散列以提高安全性

在QRcode的url中设置2个变量,一个操作和用户id。创建一个函数,当url中存在$\u GET['action']时,使用$\u GET['user']和$user\u id执行mycred\u add。感谢您的这个bux,据我所知。我将有一个名为mycredapi的网页,其中将嵌入一个php脚本,使用您放在那里的脚本代码片段,它将与我的插件对话。如果你愿意的话,我愿意赔偿我的损失!