php str_replace header.php 中的动态 url?
嘿伙计们, 一个有点奇怪的问题,实际上并不需要与 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果该网站未上线,您可以暂时将
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.