PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function is_homepage($url) { $parsed_url = parse_url($url); // 判断是否为首页 if (!isset($parsed_url['path']) || empty($parsed_url['path']) || $parsed_url['path'] == '/') { return 1; } else { return 0; } } // 测试函数 $url1 = "http://isharefashion.com/#9f57258m"; $url2 = "http://www.example.com/index.php"; $url3 = "http://www.example.com/about.php"; echo is_homepage($url1); // 输出: 1 echo is_homepage($url2); // 输出: 1 echo is_homepage($url3); // 输出: 0 ?>
Show:  
Copy Clear