简体   繁体   中英

Facebook like button with custom link

I am building a facebook like button , in the href tag i want to keep my own custom url stored in php variable. But the like button doesn't shows with it. Any solution

CODE

<?php echo '<fb:like href=" '.$urlToLink.' " width="450" layout="box_count" show_faces="false" send="false"></fb:like>'; ?>

$urlToLink has somethig like this-> "http://localhost/website/view.php?asdpfimi34mmksd"

Put the URL in the debugger and check it for Errors/Warnings: https://developers.facebook.com/tools/debug

Also, try the URL in the Plugin generator: https://developers.facebook.com/docs/reference/plugins/like/ - and see if it gets rendered correctly.

And i hope you´re not serious with "localhost", because that will not work, of course. Facebook does not have access to your localhost, and the URL you provide has to be accessible in public, without any user login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM