php 页面上动态链接的结果中有一个额外的 /directory/

发布于 2024-09-11 21:01:59 字数 494 浏览 8 评论 0 原文

我又来了。我不想打扰,但这里还有另一个有趣的事情。

我有一个定制的购物车,页面中有一些动态链接,当它们在浏览器中提供时,会将 $name 替换为产品名称,将 $p 替换为产品 ID 号。我的目标是在页面上建立一个如下链接: http://www.something.com/buy/ProductName/382793/

我得到的是 http://www .something.com/buy/ProductName/0/382793 并且没有尾部斜杠。一定要有斜线啊

代码如下所示:产品链接

您可以看到我的 $name 和 $p 用斜杠分隔,末尾有一个斜杠,但它不起作用。女士们先生们有什么想法吗?

Here I am again. I hate to be a bother but here's another zinger.

I have a custom made shopping cart and have some dynamic links in the page that when served up in a browser will replace $name with the product name and $p with the procuct id number. I'm aiming for a link on the page like this: http://www.something.com/buy/ProductName/382793/

What I'm getting is http://www.something.com/buy/ProductName/0/382793 and no trailing slash. Gotta have the slash.

The code looks like this: <a title=\"View Product.\" href=\"http://www.something.com/buy/$name/$p/". $line["PID"]. "\">PRODUCT LINKO</a>

You can see that I have $name and $p separated by a slash and a trailing slash at the end but it's not working. Any ideas ladies and gentlemen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喜爱纠缠 2024-09-18 21:01:59

末尾的“尾部”斜杠转义双引号:

<a title=\"View Product.\" href=\"http://www.something.com/buy/$name/$p/". $line["PID"]. "/\">PRODUCT LINKO</a>

应根据要求添加尾部斜杠。

The "tailing" slash at the end is escaping the double quote:

<a title=\"View Product.\" href=\"http://www.something.com/buy/$name/$p/". $line["PID"]. "/\">PRODUCT LINKO</a>

Should add the tailing slash as requested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文