简体   繁体   中英

Linking to Google Search in href

I am dynamically creating a table, and I'd like to display the title of the books to be links to a Google search of the title. I have looked at many solutions here, but all suggest something like this:

"<td><a href='http://google.com/q={$title}'>'$title'</a></td>";

echo "<TR>";
echo "<TD><a href='http://google.com/q={$title}'>$title</a></TD>";
echo "</TR>";

But I cannot get this to work since // keeps getting recognized as a comment. Is there a better way to do this?

try this one:

echo "<TR>";
echo "<TD><a href='http://google.com/?gws_rd=cr,ssl#q={$title}'>$title</a></TD>";
echo "</TR>";

it is not perfect way to search, use google search script for best result. https://developers.google.com/custom-search/docs/tutorial/implementingsearchbox

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