當前位置: 首頁>>代碼示例>>PHP>>正文


PHP phpThumb::setCacheDirectory方法代碼示例

本文整理匯總了PHP中phpThumb::setCacheDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP phpThumb::setCacheDirectory方法的具體用法?PHP phpThumb::setCacheDirectory怎麽用?PHP phpThumb::setCacheDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在phpThumb的用法示例。


在下文中一共展示了phpThumb::setCacheDirectory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: elseif

echo '">' . $phpThumb->phpthumb_version;
echo '</th><td>' . $message . '.<br></td></tr>';
echo '<tr><th>phpThumb.config.php:</th><th colspan="2" bgcolor="';
if (file_exists('../phpThumb.config.php') && !file_exists('../phpThumb.config.php.default')) {
    echo 'lime">"phpThumb.config.php" exists and "phpThumb.config.php.default" does not';
} elseif (file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
    echo 'yellow">"phpThumb.config.php" and "phpThumb.config.php.default" both exist';
} elseif (!file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
    echo 'yellow">rename "phpThumb.config.php.default" to "phpThumb.config.php"';
} else {
    echo 'yellow">"phpThumb.config.php" not found (nor "phpThumb.config.php")';
}
echo '</th><td>"phpThumb.config.php.default" that comes in the distribution must be renamed to "phpThumb.config.php" before phpThumb.php can be used. Avoid having both files present to minimize confusion.</td></tr>';
echo '<tr><th>cache directory:</th><th colspan="2">';
$orig_config_cache_directory = $phpThumb->config_cache_directory;
$phpThumb->setCacheDirectory();
echo '<div style="background-color: ' . (is_dir($phpThumb->config_cache_directory) ? 'lime;">exists' : 'red;">does NOT exist') . '</div>';
echo '<div style="background-color: ' . (is_readable($phpThumb->config_cache_directory) ? 'lime;">readable' : 'red;">NOT readable') . '</div>';
echo '<div style="background-color: ' . (is_writable($phpThumb->config_cache_directory) ? 'lime;">writable' : 'red;">NOT writable') . '</div>';
echo '</th><td>Original: "' . htmlentities($orig_config_cache_directory) . '"<br>Resolved: "' . htmlentities($phpThumb->config_cache_directory) . '"<br>Must exist and be both readable and writable by PHP.</td></tr>';
echo '<tr><th>cache write test:</th><th colspan="2">';
$phpThumb->rawImageData = 'phpThumb.demo.check.php_cachetest';
$phpThumb->SetCacheFilename();
echo '<div>' . htmlentities($phpThumb->cache_filename ? implode(' / ', split('[/\\]', $phpThumb->cache_filename)) : 'NO CACHE FILENAME RESOLVED') . '</div>';
echo '<div>directory ' . (is_dir(dirname($phpThumb->cache_filename)) ? 'exists' : 'does NOT exist') . ' (before EnsureDirectoryExists())</div>';
phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
echo '<div style="background-color: ' . (is_dir(dirname($phpThumb->cache_filename)) ? 'lime;">directory exists' : 'red;">directory does NOT exist') . ' (after EnsureDirectoryExists())</div>';
if ($fp = @fopen($phpThumb->cache_filename, 'wb')) {
    fwrite($fp, 'this is a test from ' . __FILE__);
    fclose($fp);
    echo '<div style="background-color: lime;">write test succeeded</div>';
開發者ID:jtresca,項目名稱:nysurveyor,代碼行數:31,代碼來源:phpThumb.demo.check.php


注:本文中的phpThumb::setCacheDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。