問題描述
使用 JS API 集成 LinkedIn 登錄 (Integrate LinkedIn login using JS API)
I am trying to integrate Login In Using LinkedIn. I am use LinkedIn's Javascript API. I have generated an application and API key. Then I have successfully imported their framework as mentioned in their example. I am not getting the login button it shows some error
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: my_api_key
authorize: true
</script>
<body>
<script type="in/Login">Hello, <?js= firstName ?> <?js= lastName ?>.</script>
</body>
When I specify the script in body, the tutorial says a LinkedIn sign in button appears, but for me an error prompts
Parse error: syntax error, unexpected '=' in /home/casarevi/public_html/lsign.php on line 12
參考解法
方法 1:
While the RIGHT thing to do here would be to turn off short_tags (as Adam has suggested), an easy workaround here is to change the code to read:
<script type="in/Login">
Hello, <?php echo '<';?>?js= firstName ?> <?php echo '<';?>?js=lastName ?>.
</script>
LinkedIn's Javascript API will treat this as the same. Works like a charm without having to change your .ini settings.
方法 2:
Do you have PHP short_tags enabled?
(by Mohandass、butangphp、Adam Trachtenberg)