本文整理汇总了PHP中CoreLocal::convertIniPhpToJson方法的典型用法代码示例。如果您正苦于以下问题:PHP CoreLocal::convertIniPhpToJson方法的具体用法?PHP CoreLocal::convertIniPhpToJson怎么用?PHP CoreLocal::convertIniPhpToJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreLocal
的用法示例。
在下文中一共展示了CoreLocal::convertIniPhpToJson方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkWritable
public static function checkWritable($filename, $optional = False, $template = False)
{
$basename = basename($filename);
$failure = $optional ? 'blue' : 'red';
$status = $optional ? 'Optional' : 'Warning';
if (!file_exists($filename) && !$optional) {
$fp = fopen($filename, 'w');
if ($fp) {
if ($template !== False) {
switch ($template) {
case 'PHP':
fwrite($fp, "<?php\n");
break;
case 'JSON':
fwrite($fp, CoreLocal::convertIniPhpToJson());
break;
}
}
fclose($fp);
}
}
if (!file_exists($filename)) {
echo "<span style=\"color:{$failure};\"><b>{$status}</b>: {$basename} does not exist</span><br />";
if (!$optional) {
echo "<b>Advice</b>: <div style=\"font-face:mono;background:#ccc;padding:8px;\">\n touch \"" . realpath(dirname($filename)) . "/" . basename($filename) . "\"<br />\n chown " . self::whoami() . " \"" . realpath(dirname($filename)) . "/" . basename($filename) . "\"</div>";
}
} elseif (is_writable($filename)) {
echo "<span style=\"color:green;\">{$basename} is writeable</span><br />";
} else {
echo "<span style=\"color:red;\"><b>Warning</b>: {$basename} is not writeable</span><br />";
echo "<b>Advice</b>: <div style=\"font-face:mono;background:#ccc;padding:8px;\">\n chown " . self::whoami() . " \"" . realpath(dirname($filename)) . "/" . basename($filename) . "\"<br />\n chmod 600 \"" . realpath(dirname($filename)) . "/" . basename($filename) . "\"</div>";
}
}