0
可我知道如何检查的动态URL剩余域内的用户,让他们被允许创建自己的网站,网址的同时为用户博客创建动态网址,我需要指定用户可以创建的网址的可用性?
的步骤,我在下面: 1)通过文本框中,他们将能写他们的昵称/ personal_identity例如:说Custom_Blog
2)所以,我的网站域将是http://example.com/Custom_Blog/为指定的用户。
3)冲突:但我有一个在htaccess中创建的标签“http://example.com/Custom_Blog”,用于编辑用户的博客详细页面。
所以,当用户在文本框中输入时,我需要验证url的可用性,无论url是否已被使用? 我想这个代码是没有帮助的,因为它是获取代码302的网址是已经被用(存在):
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);
/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404 || $httpCode == 302) {
/* Handle 404 here. */
}
curl_close($handle);