从PHP中的url获取# [英] get a # from a url in php

查看:357
本文介绍了从PHP中的url获取#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用facebook API编码



这里说: http://developers.facebook.com/docs/authentication/javascript
获取access_token的东西,但它是在#而不是? p>

所以我该怎么办?



http://www.example.com/callback#access_token=...&expires_in= ...

解决方案

您将无法在PHP中执行此操作 - 您只能在javascript中访问它 - 片段/哈希从不到达服务器,它在Javascript中由浏览器



处理,您可以使用

  window.location.hash 


I'm trying to code with the facebook API

here it says : http://developers.facebook.com/docs/authentication/javascript to get the access_token thing, but it's after a # and not a ?

so how can I get it ?

http://www.example.com/callback#access_token=...&expires_in=...

解决方案

You won't be able to do it in PHP - you can only access it in javascript - the fragment/hash never reaches the server, it is processed by the browser

in Javascript, you can access the fragment using

window.location.hash

这篇关于从PHP中的url获取#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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