Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 wordpress 网站上有一个 ajax 登录小部件,只有我和其他管理员需要查看它,所以我想知道是否有办法只将此小部件提供给我的 IP 地址和其他管理员
您可以使用 .htaccess 这样做,只允许某些 IP 地址访问您的 wp-login.php
<Files wp-login.php> Order Deny,Allow Deny from all Allow from xx.xx.xx.xx </Files>
更新:如果你想控制谁查看小部件,你可以使用条件语句使用 PHP 的 $_SERVER['REMOTE_ADDR'] 来获取访问者的 IP 地址。如果它与某个地址匹配,则显示小部件。