在页面上只运行一次PHP回发请求一次? [英] Run a PHP postback request on a page only once?

查看:191
本文介绍了在页面上只运行一次PHP回发请求一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道PHP中是否存在相当于 IsPostBack 的文件。一旦用户登录,我只想调用函数或方法一次。



我有一个Facebook应用程序,其中一旦用户授权应用程序在数据库中输入他的详细信息。这个基本的东西应该是使用后授权的回调网址完成的,当用户首次授权该应用程序时,Facebook会ping。



问题是,由于我正在检查用户存在或不存在于index.php中,当用户每次进入主页时,我都不希望index.php为同一用户重复运行此代码。



是否有任何PHP代码只能运行一次?

解决方案

pre> < input type =submitvalue =submitname =submit_button/>
<?php
if(isset($ _ POST ['submit_button']))
{
//只有在postback
}
才执行? >


I would like to know if there is an equivalent of IsPostBack in PHP. I want to call a function or a method only once, once the user is logged in.

I have a facebook application, in which once the user authorizes the application it should enter his details in the database. This basic stuff should have been done using the post-authorize callback url which facebook pings when the user first authorizes the app.

The issue is that since I am checking whether the user exists or not in index.php, I would not like index.php to run this code repeatedly for the same user when the user goes to the homepage every time.

Is there any PHP code that will run it only once?

解决方案

<input type="submit" value="submit" name="submit_button" />
<?php
if(isset($_POST['submit_button']))
{
    // only execute if postback
}
?>

这篇关于在页面上只运行一次PHP回发请求一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆