php str_replace header.php 中的动态 url?

发布于 2024-10-01 08:59:09 字数 673 浏览 0 评论 0原文

嘿伙计们, 一个有点奇怪的问题,实际上并不需要与 wordpress 相关联。

我想在我的 iPhone 上测试一个 WordPress 网站。因为我在同一个网络中,所以我可以简单地从我的 iPhone 调用我的本地 apache 服务器。然而,由于我的设置有点复杂,iPhone 上的网站对其所有样式表和 js 文件的链接完全错误。

无论如何,因为我不是一个真正的 php 人,所以我想知道是否可以在 header.php 的末尾运行 php 脚本,以将任何 http://mylocaltestdomain.com 替换为 < strong>http://192.168.172.29/mylocaltestdomain.com

但是,所有样式表链接都是动态生成的。例如

<script src="<?php bloginfo('template_directory'); ?>/js/scripts.js" type="text/javascript" charset="UTF-8"></script>

,再次如此,只是为了让您明白:我想知道是否可以用其他结构替换所有动态 WordPress 链接(bloginfo('template_directory'...) 。

这可能吗?如何?

谢谢

hey guys,
a little weird question that doesn't actually need to be associated with wordpress.

i want to test a wordpress website on my iPhone. since i'm in the same network, i can simply call my local apache server from my iphone. however since my setup is a bit complicated the website on the iphone has completely wrong links to all its stylesheets and js-files.

anyway, since i'm not really a php person i wonder if it's simply possible to run a php script at the end of my header.php to just replace any http://mylocaltestdomain.com by http://192.168.172.29/mylocaltestdomain.com

however all the links to stylesheets are generated dynamically. e.g.

<script src="<?php bloginfo('template_directory'); ?>/js/scripts.js" type="text/javascript" charset="UTF-8"></script>

so again, just so you get it: i wonder if it's possible to replace all dynamic wordpress links (bloginfo('template_directory'...) with some other structure.

is that possible? how?

thank you

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

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

发布评论

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

评论(1

迟月 2024-10-08 08:59:09

如果该网站未上线,您可以暂时将 WordPress 地址 (URL) 值(在“设置”->“常规”中)更改为服务器的 IP 地址。

If the site isn't live, you could temporarily change the WordPress address (URL) value (in Settings -> General) to the server's IP address.

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