本文整理汇总了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);