用PHP编写.htaccess文件以从URL更新AJAX允许 [英] Writing .htaccess file with php to update AJAX allow from urls

查看:52
本文介绍了用PHP编写.htaccess文件以从URL更新AJAX允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为网站上的文章创建一些嵌入.嵌入程序会调用一个Javascript文件,该文件找出要从我的网站上抓取的文章,然后对相应的JSON文件进行AJAX调用,以抓取该文章,对其进行解析然后显示.

I'm working to create some embeds for articles on a site. The embeds call a Javascript file that figures out which article to grab from my site and makes an AJAX call to the appropriate JSON file to grab the article, parse it and then display it.

我还有一个会员系统,允许人们注册一个帐户,告诉我他们将在哪个网站上使用嵌入程序.

I also have a member system going which will allow people to sign up for an account telling me what site they will use the embeds on.

我想做的是在这些JSON文件的根文件夹上有一个.htaccess文件,以便只有获得批准的成员才能使用该嵌入程序,从而可以对这些JSON文件进行AJAX调用.

What I want to do is have an .htaccess file on the root folder of these JSON files so that only approved members can use the embed which makes AJAX calls to these JSON files.

.htaccess文件将具有允许AJAX到文件夹的允许URL的列表.问题是,随着成员的添加和删除,它必须进行更新.

The .htaccess file will have a list of allow urls that can AJAX to the folder. The thing is it will have to be updated as members are added and deleted.

用PHP不断更新此.htaccess文件的最佳方法是什么?

What's the best way to constantly update this .htaccess file with PHP?

非常感谢!

推荐答案

为什么不使用php进行检查并使用php分发文件?为每个成员创建规则是非常糟糕的做法,而且还会减慢服务器速度

why dont make your checks with php and hand out the files with php? its very bad practice to create rule for every single member and also will slow down the server

这篇关于用PHP编写.htaccess文件以从URL更新AJAX允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆