本文整理汇总了PHP中v函数的典型用法代码示例。如果您正苦于以下问题:PHP v函数的具体用法?PHP v怎么用?PHP v使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了v函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
$dao = DAO::getDAO('UserDAO');
if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
// ex: requesting: /user-list/delete/2
$id = trim(sanitizeString($this->params[1]));
$dao->removeById($id);
} else {
if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
$randNum = mt_rand(0, 99999);
$newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime()));
// #TODO: implement UserDao.create($newUser) instead.
if ($dao->countAll() > 30) {
// Demo mode: clean up if too many users
$dao->execute("DELETE FROM user");
$dao->execute("vacuum");
}
$dao->insertInto("firstName, lastName, username, email, createTime", $newUser->getFields());
}
}
$users = $dao->getAll();
$v = $this->smarty;
$v->assign('title', 'User List');
$v->assign('inc_content', v('user_list.html'));
$v->assign('users', $users);
$v->assign('totalUsers', $dao->countAll());
$this->display($v, v('index.html'));
}
示例2: weixin
/**
* 支付
*
* @param $param
*/
public function weixin($param)
{
if (!v('module.name') || !Session::get('member.uid') || empty($param['goods_name']) || empty($param['fee']) || empty($param['body']) || empty($param['tid'])) {
message('支付参数错误,请重新提交', 'back', 'error');
}
if ($pay = Db::table('pay')->where('tid', $param['tid'])->first()) {
if ($pay['status'] == 1) {
message('定单已经支付完成', $param['back_url'], 'success');
}
}
$data['siteid'] = SITEID;
$data['uid'] = Session::get('member.uid');
$data['tid'] = $param['tid'];
$data['fee'] = $param['fee'];
$data['goods_name'] = $param['goods_name'];
$data['attach'] = isset($param['attach']) ? $param['attach'] : '';
//附加数据
$data['module'] = v('module.name');
$data['body'] = $param['body'];
$data['attach'] = $param['attach'];
$data['status'] = 0;
$data['is_usecard'] = isset($param['is_usecard']) ? $param['is_usecard'] : 0;
$data['card_type'] = isset($param['card_type']) ? $param['card_type'] : '';
$data['card_id'] = isset($param['is_usecard']) ? $param['card_id'] : 0;
$data['card_fee'] = isset($param['card_fee']) ? $param['card_fee'] : 0;
if (empty($pay)) {
Db::table('pay')->insertGetId($data);
}
Session::set('pay', ['tid' => $data['tid'], 'module' => v('module.name'), 'siteid=' => SITEID]);
View::with('data', $data);
View::make('server/build/template/pay.html');
}
示例3: getContent
/**
* Get content
*/
public function getContent()
{
session("name");
session_unset();
if (post("login")) {
v("message", t("login.1"));
$user = RDR_User::login(post("username"), post("password"), post("remember"));
if ($user) {
if (get("redirect")) {
redirect(get("redirect"));
}
redirect(l("RDR_Home"), 302);
}
}
?>
<div class="center">
<img src="<?php
echo url()->getByAlias("public", "img/logo-1.png");
?>
" alt=""/>
</div>
<?php
$table = new Form_Table($this->getForm());
$table->addSubmit("Login");
echo $table->getHtml();
}
示例4: post
public function post()
{
if (IS_POST) {
$data = json_decode(Request::post('keyword'), TRUE);
$data['rank'] = $data['istop'] == 1 ? 255 : min(255, intval($data['rank']));
$data['module'] = v('module.name');
$data['keywords'] = $data['keyword'];
$rid = service('WeChat')->rule($data);
//调用模块的执行方法
$module = new $this->moduleClass();
//字段验证
if ($msg = $module->fieldsValidate($rid)) {
message($msg, 'back', 'error');
}
//使模块保存回复内容
$module->fieldsSubmit($rid);
message('规则保存成功', u('post', ['rid' => $rid, 'm' => v('module.name')]));
}
//获取关键词回复
if ($rid = Request::get('rid')) {
$data = Db::table('rule')->find($rid);
if (empty($data)) {
message('回复规则不存在', 'back', 'error');
}
$data['keyword'] = Db::table('rule_keyword')->orderBy('id', 'asc')->where('rid', $rid)->get();
View::with('rule', $data);
}
$module = new $this->moduleClass();
$moduleForm = $module->fieldsDisplay($rid);
return view()->with('moduleForm', $moduleForm);
}
示例5: test
/**
* execute tests
*/
public function test($action, $context)
{
$action = us($action);
$test_data_dir = $context->getFile(s('%APPLICATION_DIR%/test_data/class/io'));
switch ($action) {
case "combined_regex":
$filter1 = new Charcoal_RegExFileFilter(s('/sample_file1\\.txt/'));
$filter2 = new Charcoal_RegExFileFilter(s('/sample_file[23]\\.txt/'));
$filter = new Charcoal_CombinedFileFilter(v(array($filter1, $filter2)));
$files = $test_data_dir->listFiles($filter);
$files_found = array();
foreach ($files as $file) {
$files_found[] = $file->getName();
}
$expected = array('sample_file1.txt', 'sample_file2.txt', 'sample_file3.txt');
$this->assertEquals('array', gettype($files));
$this->assertEquals(3, count($files));
$this->assertEquals(array(), array_diff($files_found, $expected));
return TRUE;
case "combined_wildcard":
return TRUE;
case "combined_complexed":
return TRUE;
}
return FALSE;
}
示例6: addFile
/**
*
* @param CUploadedFile $fileInstance
*/
public function addFile($fileInstance, $filename = false, $extraFormat = false)
{
$filePath = $this->pathToData . DIRECTORY_SEPARATOR . $this->prefix . $this->id . DIRECTORY_SEPARATOR;
$accessModel = new PropertyfileModel();
$generateName = 'u' . md5(uniqid(""));
$fullNameParts = explode('.', $fileInstance->getName());
if (!$extraFormat) {
$format = array_pop($fullNameParts);
} else {
$format = $extraFormat;
}
if (!$filename) {
$filename = $generateName;
} else {
$filename = str_replace(' ', '', $filename);
}
$generateName .= $generateName . '.' . $format;
$folder = YII::getPathOfAlias('application.data.id' . $this->id) . DIRECTORY_SEPARATOR;
if (!is_dir($folder)) {
return false;
}
$accessModel->unsetAttributes();
$accessModel->setAttributes(array('property_id' => $this->id, 'filename' => $filename . '.' . $format, 'systempath' => $generateName));
if (!$accessModel->save()) {
return false;
}
if (!$fileInstance->saveAs($folder . $generateName, false)) {
var_dump($filename . '.' . $format);
v($folder . $generateName);
return false;
}
$resultData = array('filename' => $filename, 'systemname' => $generateName, 'id' => $accessModel->getAttribute('id'));
return $resultData;
}
示例7: update
public function update($event, $val = null)
{
switch ($event) {
case Render::CHUNK:
$this->flags = $val;
break;
case Render::STANDALONE:
if ($val) {
$this->registerElementMap(static::getDefaultElementMap());
$this->registerTextMap(static::getDefaultTextMap());
}
break;
case Render::INIT:
$this->setOutputDir(Config::output_dir() . strtolower($this->getFormatName()) . '/');
$this->postConstruct();
if (file_exists($this->getOutputDir())) {
if (!is_dir($this->getOutputDir())) {
v("Output directory is a file?", E_USER_ERROR);
}
} else {
if (!mkdir($this->getOutputDir())) {
v("Can't create output directory", E_USER_ERROR);
}
}
if (Config::css()) {
$this->fetchStylesheet();
}
break;
case Render::VERBOSE:
v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
示例8: update
public function update($event, $val = null)
{
switch ($event) {
case Render::CHUNK:
case Render::STANDALONE:
case Render::VERBOSE:
parent::update($event, $val);
break;
case Render::INIT:
$this->setOutputDir(Config::output_dir() . strtolower($this->getFormatName()) . '/');
$this->postConstruct();
if (file_exists($this->getOutputDir())) {
if (!is_dir($this->getOutputDir())) {
v("Output directory is a file?", E_USER_ERROR);
}
} else {
if (!mkdir($this->getOutputDir(), 0777, true)) {
v("Can't create output directory", E_USER_ERROR);
}
}
if (Config::css()) {
$this->fetchStylesheet();
}
break;
}
}
示例9: delete_planet
public function delete_planet(array $params)
{
$planetID = array_val_required($params, 'planetID');
$planet = m('Planet', $planetID);
$planet->delete();
v('json/success', 'Planet deleted');
}
示例10: register
public function register()
{
//系统维护检测
service('user')->checkSystemClose();
if (IS_POST) {
Validate::make([['code', 'captcha', '验证码输入错误', 1], ['password', 'confirm:password2', '两次密码输入不一致', 3]]);
//默认用户组
$User = new User();
$User['username'] = Request::post('username');
//用户组过期时间
$daylimit = Db::table('user_group')->where('id', v('config.register.groupid'))->pluck('daylimit');
$User['endtime'] = time() + $daylimit * 3600 * 24;
//获取密码与加密密钥
$info = $User->getPasswordAndSecurity();
$User['password'] = $info['password'];
$User['security'] = $info['security'];
$User['email'] = Request::post('email');
$User['qq'] = Request::post('qq');
$User['mobile'] = Request::post('mobile');
$User['groupid'] = v('config.register.groupid');
$User['status'] = v('config.register.audit');
if (!$User->save()) {
message($User->getError(), 'back', 'error');
}
message('注册成功,请登录系统', u('login', ['from' => $_GET['from']]));
}
return view();
}
示例11: execute_request
function execute_request(&$db)
{
// do not append or prepend anything to output if we have to download
$output = v($_REQUEST["type"]) == 'download' ? false : true;
if ($output) {
startForm($db);
}
if (isset($_REQUEST["type"])) {
$module_requested = $_REQUEST["type"];
$_REQUEST["query"] = trim(v($_REQUEST["query"], ""), " \t\r\n;");
$module = BASE_PATH . "/modules/" . $module_requested . ".php";
if (ctype_alpha($module_requested) && file_exists($module)) {
require BASE_PATH . '/config/modules.php';
// check for module access type and allow/disallow as needed
if (MODULE_ACCESS_MODE == 'deny' && in_array($module_requested, $DENY_MODULES)) {
createErrorPage();
} else {
if (MODULE_ACCESS_MODE == 'allow' && !in_array($module_requested, $ALLOW_MODULES)) {
createErrorPage();
} else {
include $module;
function_exists('processRequest') ? processRequest($db) : createErrorGrid($db, "");
}
}
} else {
createErrorPage();
}
// unidentified type requested
}
if ($output) {
print "</form>\n";
print "</body></html>";
}
}
示例12: view
public function view()
{
$v = $this->smarty;
$v->assign('title', 'Our Products');
$v->assign('inc_content', v('products/jackets.html'));
$this->display($v, v('index.html'));
}
示例13: format_root_set
public function format_root_set($open, $name, $attrs, $props)
{
if ($open) {
parent::newChunk();
$this->cchunk = $this->dchunk;
$pdfDoc = new PdfWriter();
try {
$pdfDoc->setCompressionMode(\HaruDoc::COMP_ALL);
} catch (\HaruException $e) {
v("PDF Compression failed, you need to compile libharu with Zlib...", E_USER_WARNING);
}
parent::setPdfDoc($pdfDoc);
if (isset($attrs[Reader::XMLNS_XML]["base"]) && ($base = $attrs[Reader::XMLNS_XML]["base"])) {
parent::setChunkInfo("xml-base", $base);
}
$id = $attrs[Reader::XMLNS_XML]["id"];
$this->cchunk["root-outline"] = $this->cchunk["id-to-outline"][$id] = $pdfDoc->createOutline(Format::getShortDescription($id), null, true);
$this->setIdToPage($id);
} else {
$this->resolveLinks($this->cchunk["setname"]);
$pdfDoc = parent::getPdfDoc();
v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING);
$filename = $this->getOutputDir();
if (Config::output_filename()) {
$filename .= Config::output_filename();
} else {
$filename .= strtolower($this->getFormatName()) . $this->getExt();
}
$pdfDoc->saveToFile($filename);
unset($pdfDoc);
}
return "";
}
示例14: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(RDR_User::ROLE_ADMIN, true);
$this->user = new RDR_User(db());
if (get("id")) {
$tmp = RDR_User::getById(get("id"));
if ($tmp) {
$this->user = $tmp;
}
}
$this->form = $this->getForm();
if (post("save")) {
if (!$this->form->validateAllFields()) {
v("message", t("form.validation.error"));
} elseif (post("password") && post("password") != post("password2")) {
v("message", t("admin.user.2"));
} else {
$this->form->setObjectMembersBySubmittedValues($this->user);
if (post("password")) {
$this->user->setPassword(post("password"));
}
$this->user->store();
v("message", t("saved"));
$this->form = $this->getForm();
}
}
view("RDR_BasicFrame", array("view" => $this));
}
示例15: action_comments_list
function action_comments_list()
{
global $data;
$comm = new model("comments");
$data["articles"] = $comm->page("service_id,object_id,id,ip,create_time,author,service_name");
v();
}