本文整理汇总了PHP中v函数的典型用法代码示例。如果您正苦于以下问题:PHP v函数的具体用法?PHP v怎么用?PHP v使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了v函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:rsanaie,项目名称:Thin-PHP-Framework,代码行数:28,代码来源:UserList.php
示例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');
}
开发者ID:houdunwang,项目名称:hdcms,代码行数:37,代码来源:Pay.php
示例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();
}
开发者ID:nonconforme,项目名称:nreeda,代码行数:30,代码来源:Login.class.php
示例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);
}
开发者ID:houdunwang,项目名称:hdcms,代码行数:31,代码来源:Reply.php
示例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;
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:29,代码来源:CombinedFileFilterTestTask.class.php
示例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;
}
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:38,代码来源:propertyFile.php
示例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;
}
}
开发者ID:philip,项目名称:phd,代码行数:33,代码来源:ChunkedXHTML.php
示例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;
}
}
开发者ID:marczych,项目名称:hack-hhvm-docs,代码行数:26,代码来源:HowTo.php
示例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');
}
开发者ID:Tapac,项目名称:hotscot,代码行数:7,代码来源:planet.php
示例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();
}
开发者ID:houdunwang,项目名称:hdcms,代码行数:28,代码来源:Entry.php
示例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>";
}
}
开发者ID:pollin14,项目名称:MyWebSQL,代码行数:34,代码来源:util.php
示例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'));
}
开发者ID:renduples,项目名称:alibtob,代码行数:7,代码来源:Jackets.php
示例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 "";
}
开发者ID:TazeTSchnitzel,项目名称:phd,代码行数:33,代码来源:BigPDF.php
示例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));
}
开发者ID:nonconforme,项目名称:nreeda,代码行数:31,代码来源:User.class.php
示例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();
}
开发者ID:xurenlu,项目名称:tik,代码行数:7,代码来源:m.php
示例16: displayUserForm
function displayUserForm(&$db, &$editor, $message, $action)
{
$dbList = $db->getDatabases();
$userList = $editor->getUsersList();
$privilegeNames = Privileges::getNames();
$dbPrivilegeNames = DbPrivileges::getNames();
// current user name is not plaintext in case of 'update' action
$userName = '';
if ($action == 'update') {
$obj = json_decode(v($_REQUEST['query']));
if (is_object($obj)) {
$userName = $obj->username . '@' . $obj->hostname;
}
} else {
$userName = v($_REQUEST['query']);
}
$currentUser = selectUser($userList, $userName);
$privileges = array();
$dbPrivileges = array();
$userInfo = array();
if ($currentUser) {
$privileges = $currentUser->getGlobalPrivileges();
foreach ($dbList as $db_name) {
$dbPrivileges[$db_name] = $currentUser->getDbPrivileges($db_name);
}
$userInfo = array('username' => $currentUser->userName, 'host' => $currentUser->host);
}
$users = userOptions($userList, $currentUser);
$replace = array('ID' => v($_REQUEST["id"]) ? htmlspecialchars($_REQUEST["id"]) : '', 'MESSAGE' => $message, 'USERS' => $users, 'USER_INFO' => json_encode($userInfo), 'DATABASES' => json_encode($dbList), 'PRIVILEGES' => json_encode($privileges), 'DB_PRIVILEGES' => json_encode($dbPrivileges), 'PRIVILEGE_NAMES' => json_encode($privilegeNames), 'DB_PRIVILEGE_NAMES' => json_encode($dbPrivilegeNames));
echo view('usermanager', $replace);
}
开发者ID:guohuadeng,项目名称:stampApp,代码行数:31,代码来源:usermanager.php
示例17: view
public function view()
{
$v = $this->smarty;
$v->assign('title', t('product_page_title'));
$v->assign('inc_content', v('products/our_products.html'));
$this->display($v, v('index.html'));
}
开发者ID:renduples,项目名称:alibtob,代码行数:7,代码来源:OurProducts.php
示例18: view
public function view()
{
$dao = DAO::getDAO('SearchDAO');
if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
// ex: requesting: /search/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);
$newSearch = new Search(array('username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'created' => dbDateTime()));
// #TODO: implement UserDao.create($newUser) instead.
if ($dao->countAll() > 30) {
// Demo mode: clean up if too many searchs
$dao->execute("DELETE FROM searchs");
$dao->execute("vacuum");
}
$dao->insertInto("username, email, created", $newSearch->getFields());
}
}
$search = $dao->getAll();
$v = $this->smarty;
$v->assign('title', 'Search List');
$v->assign('inc_content', v('search.html'));
$v->assign('search', $search);
$v->assign('totalSearch', $dao->countAll());
$this->display($v, v('index.html'));
}
开发者ID:renduples,项目名称:alibtob,代码行数:28,代码来源:Search.php
示例19: delete_inhabitant
public function delete_inhabitant(array $params)
{
$inhabitantID = array_val_required($params, 'inhabitantID');
$inhabitant = m('inhabitant', $inhabitantID);
$inhabitant->delete();
v('json/success', 'Inhabitant deleted');
}
开发者ID:Tapac,项目名称:hotscot,代码行数:7,代码来源:inhabitant.php
示例20: checklogin
function checklogin()
{
header("Content-type: text/html; charset=utf-8");
$username = v('username');
$password = v('password');
$user_info = get_master_info($username);
if ($user_info) {
$realpass = md5($password);
if ($realpass == $user_info['password']) {
session_start();
$_SESSION['user'] = $username;
$_SESSION['pass'] = md5($realpass);
echo "<script>";
echo "window.location.href = '" . c($site_url) . "?c=backedit'";
echo "</script>";
} else {
echo "<script>";
echo "alert('用户名或密码错误');";
echo "window.location.href = '" . c($site_url) . "?c=login'";
echo "</script>";
}
} else {
echo "<script>";
echo "alert('用户名或密码错误');";
echo "window.location.href = '" . c($site_url) . "?c=login'";
echo "</script>";
}
}
开发者ID:doumaomao,项目名称:Lazy-lawyer,代码行数:28,代码来源:login.class.php
注:本文中的v函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论