本文整理匯總了PHP中padding函數的典型用法代碼示例。如果您正苦於以下問題:PHP padding函數的具體用法?PHP padding怎麽用?PHP padding使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了padding函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: session_start
<?php
session_start();
require __DIR__ . '/../function/news-plus.php';
$article['image'] = $_POST['image'];
if (isset($_POST)) {
$article = [];
if (!empty($_POST['header'])) {
$article['header'] = $_POST['header'];
if (!empty($_POST['padding'])) {
$article['padding'] = $_POST['padding'];
if (headers($article)) {
if (padding($article)) {
if (!empty($_FILES)) {
$res = image($_FILES);
if (false !== $res) {
$article['image'] = $res;
if (isset($article['header']) && isset($article['padding']) && isset($article['image'])) {
News::article_put($article);
header('Location:http://new/index.php?cntr=Newsed&act=All');
exit;
}
} else {
if (isset($article['header']) && isset($article['padding'])) {
News::article_two_put($article);
header('Location:http://new/index.php?cntr=Newsed&act=All');
exit;
}
}
} else {
$_SESSION['error'] = 'Статья не написана!';
示例2: empty_field_and_submit
//<![CDATA[
scroll_active = true;
function empty_field_and_submit(){
document.fdummy.arsc_message.value=document.f.arsc_message.value;
document.fdummy.submit();
document.f.arsc_message.focus();
document.f.arsc_message.select();
return false;
}
//]]>
</script>
</head><body OnLoad="document.f.arsc_message.focus();document.f.arsc_message.select();">;
EOD;
// Dummy data that gets output to the browser as needed, in order to make it show output
global $CHAT_DUMMY_DATA;
$CHAT_DUMMY_DATA = padding(200);
/**
* @param int $n
* @return string
*/
function padding($n)
{
$str = '';
for ($i = 0; $i < $n; $i++) {
$str .= "<!-- nix -->\n";
}
return $str;
}
/**
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
示例3: preg_replace_callback
$column->setAttribute('type', '');
$table->appendChild($column);
$dom->appendChild($table);
/*
* The default indentation of DOMDocument is 2 spaces, replace them with 4
* spaces instead
*/
$content = preg_replace_callback('@^( +)<@m', function ($matches) {
return str_repeat(' ', (int) strlen($matches[1] / 2) * 4) . '<';
}, $dom->saveXML());
/*
* Guratee that both schema file is saved and the db_migration is updated
* atomically
*/
if (fwrite($schemaFile, $content) === false) {
throw new CLIException('Unable to save ' . $schemaFilePath);
} else {
fclose($schemaFile);
if (!($migrationFile = fopen($migrationFilePath, 'wb'))) {
throw new CLIException('Unable to open and truncate' . $migrationFilePath);
}
if (fwrite($migrationFile, $schemaContent) === false) {
throw new CLIException("Unable to save `{$migrationFilePath}`");
unlink($schemaFilePath);
} else {
fclose($migrationFile);
}
}
$output = '===== Created schema file: ' . $schemaFilePath . ' ';
echo padding($output);
$return = array('file' => $schemaFileName, 'path' => $schemaFilePath);