Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.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 facebook在url中传递参数_Php_Facebook - Fatal编程技术网

Php facebook在url中传递参数

Php facebook在url中传递参数,php,facebook,Php,Facebook,我想在我的url中传递一个facebook用户ID作为参数 看起来是这样的: <form action="<?php echo 'single_picture.php?argument=' . $picture_id . '&hus=' . $user_profile['id'] ?>" method="post"> <input type="submit" name="submit" value="Vote!"> </form> 这会在

我想在我的url中传递一个facebook用户ID作为参数

看起来是这样的:

<form action="<?php echo 'single_picture.php?argument=' . $picture_id . '&hus=' . $user_profile['id'] ?>" method="post">
<input type="submit" name="submit" value="Vote!">
</form>

这会在我登录时打印出我的ID。

现在我意识到,您不需要表单。 只需执行和ajax函数并将参数传递到此处:

例如:


您可以将其存储在会话中,但安全方面不推荐使用。我会使用Google chrome的inspect元素对发送的请求进行双重检查。您可以看到GET变量及其值。运气不好:(我很难弄清楚,因为我发现了一些非常简单的示例,但由于某些原因,参数1始终有效,但hus从未有效:/it's奇怪。请尝试使用firebug检查参数值,并在此处发布结果。非常感谢您的帮助:)
$picture_id = $_GET['argument'];
$fbargument = $_GET["hus"];

echo "\npicture_id: ";
echo $picture_id;

echo '<br />';

echo "\$fbargument: ";
echo $fbargument;
$user_profile = $facebook->api('/me','GET');
echo "id: " . $user_profile['id'];
<input type="hidden" id="argument" value="<?= $picture_id?>">
<input type="hidden" id="hus" value="<?= $user_profile['id']?>">

$(document).on('click', '#submit', function() { 
    var argument = $("#argument").val(),
        hus = $("#hus").val();

    $.ajax({
        type:"POST",
        url: 'url.php',
        data: { argument: argument , hus: hus },
        dataType: "html",
        success: function(e) {
            //do something
        }
    });
});