我对Google Cloud有问题。我的PHP代码在Google Cloud上无法正常工作。
问题:
我的页面php仅回显“脱机网络”,而不去http://domaintest.com。
如何解决?
Index.php
<?php
$host = 'google.com';
if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
echo "<script> window.location = 'http://domaintest.com'; </script> ";
fclose($socket);
} else {
echo "Web Offline";
}
?>
app.yml
runtime: php55
api_version: 1
handlers:
# Serve php scripts.
- url: /.*
script: index.php
注意:我要检查网络状态,如果网络不关闭,此页面将重定向到另一个页面。