本文整理汇总了PHP中PHPWS_Text::randomString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Text::randomString方法的具体用法?PHP PHPWS_Text::randomString怎么用?PHP PHPWS_Text::randomString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Text
的用法示例。
在下文中一共展示了PHPWS_Text::randomString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createReport
function createReport()
{
if ($this->class) {
$methods = get_class_methods($this->class);
if (in_array($this->report_row, $methods)) {
$func_type = 'method';
}
}
if (!isset($func_type)) {
if (function_exists($this->report_row)) {
$func_type = 'function';
} else {
$func_type = 'none';
}
}
$index_set = false;
$tmp_file = \PHPWS_Text::randomString(10) . time();
$directory = CACHE_DIRECTORY;
$file_path = sprintf('%s/%s', $directory, $tmp_file);
$fp = fopen($file_path, 'w');
foreach ($this->display_rows as $foo) {
if ($func_type == 'method') {
$result = call_user_func(array($foo, $this->report_row));
} elseif ($func_type == 'function') {
$result = call_user_func($this->report_row, $foo);
} else {
if (is_object($foo)) {
$result = PHPWS_Core::stripObjValues($foo);
} else {
$result =& $foo;
}
}
if (!$index_set) {
$index_keys = array_keys($result);
$row = fputcsv($fp, $index_keys);
$index_set = true;
}
fputcsv($fp, $result);
//$row = self::formatCSVRow($result);
//fwrite($fp, $row);
}
fclose($fp);
$new_file = time() . '_pager.csv';
require_once 'HTTP/Download.php';
$dl = new HTTP_Download();
$dl->setFile($file_path);
$dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $new_file);
$dl->setContentType('text/csv');
$dl->send();
exit;
}
示例2: rand
$default['scrollbars'] = 'yes';
$default['resizable'] = 'yes';
$default['width'] = '400';
$default['height'] = '300';
$default['titlebar'] = 'no';
$default['link_title'] = '';
$default['window_name'] = 'default' . rand();
$default['class'] = 'js-open-window';
$default['center'] = 1;
if (isset($data['type'])) {
if ($data['type'] == 'button') {
$bodyfile = PHPWS_SOURCE_DIR . 'javascript/open_window/body2.js';
}
}
if (isset($data['center'])) {
$data['center'] = (bool) $data['center'] ? 1 : 0;
}
$site_address = PHPWS_Core::getHomeHttp();
if (!stristr($data['address'], $site_address)) {
$data['address'] = $site_address . $data['address'];
}
if (!empty($data['secure'])) {
if (!isset($_GLOBALS['open_window_reset'])) {
unset($_SESSION['secure_open_window']);
$_GLOBALS['open_window_reset'] = true;
}
$rand = PHPWS_Text::randomString();
$data['address'] .= '&owpop=' . $rand;
$_SESSION['secure_open_window'][] = $rand;
$data['id'] = $rand;
}