本文整理汇总了PHP中V函数的典型用法代码示例。如果您正苦于以下问题:PHP V函数的具体用法?PHP V怎么用?PHP V使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了V函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: act
public function act()
{
// 添加用例
if (!$this->check_param('itemid, moduleid, casename, sendtype')) {
V('Json.Base')->init(Const_Code::CASE_PARAM_ERROR, '用例传递参数错误');
return;
}
$item_id = (int) Util_Server_Request::get_param('itemid', 'post');
$case_name = trim(Util_Server_Request::get_param('casename', 'post'));
if (M('Case')->check_name_exists($item_id, $case_name)) {
V('Json.Base')->init(Const_Code::ADD_CASE_EXISTS, '用例名称重复');
return;
}
M('Case')->insert();
$case = M('Case')->get_by_name($item_id, $case_name);
$case_id = (int) $case['id'];
if (!$case_id) {
V('Json.Base')->init(Const_Code::ADD_CASE_FAIL, '用例添加失败');
return;
}
$item = M('Item')->get_by_id($item_id);
$_POST['caseid'] = $case_id;
$_POST['stepname'] = '调用: ' . $item['name'] . '->' . $case_name;
$_POST['steptype'] = '接口调用';
$_POST['stepcommand'] = 'self';
$_POST['stepvalue'] = $case_id;
$_POST['stepsequence'] = 1;
M('Step')->insert();
V('Json.Base')->init(Const_Code::SUCCESS, $case_id);
}
示例2: login
public function login()
{
$smarty = V($this->getController());
$data['title'] = 'Tieba Cloud - Login';
$smarty->assign('data', $data);
$smarty->display('login.html');
}
示例3: act
public function act()
{
// 登录流程
if (!$this->check_param('username, password, issave')) {
V('Json.Base')->init(Const_Code::LOGIN_PARAM_ERROR, '登录传递参数错误');
return;
}
$username = trim(Util_Server_Request::get_param('username', 'post'));
$password = trim(Util_Server_Request::get_param('password', 'post'));
$is_save = (int) Util_Server_Request::get_param('issave', 'post');
$time = time();
$seckey = lb_read_system('seckey');
$user_id = (int) M('User')->check_password($username, md5($username . $password));
if (!$user_id) {
V('Json.Base')->init(Const_Code::LOGIN_FAIL, '帐号验证失败');
return;
}
$user = M('User')->get_by_id($user_id);
$expire_time = $is_save ? 86400 * 30 : 0;
Util_Client_Cookie::set_cookie('userid', $user_id, $expire_time);
Util_Client_Cookie::set_cookie('username', $user['name'], $expire_time);
Util_Client_Cookie::set_cookie('userrole', $user['role'], $expire_time);
Util_Client_Cookie::set_cookie('time', $time, $expire_time);
Util_Client_Cookie::set_cookie('secstr', md5($user_id . '$' . $user['name'] . '$' . $user['role'] . '$' . $time . '$' . $seckey), $expire_time);
V('Json.Base')->init(Const_Code::SUCCESS, '帐号验证通过');
}
示例4: act
public function act()
{
// 更新配置
if (!$this->check_param('configid, packageid, configtype, configkeyword')) {
V('Json.Base')->init(Const_Code::CONFIG_PARAM_ERROR, '配置传递参数错误');
return;
}
$config_id = (int) Util_Server_Request::get_param('configid', 'post');
$package_id = (int) Util_Server_Request::get_param('packageid', 'post');
$config_type = trim(Util_Server_Request::get_param('configtype', 'post'));
$config_keyword = trim(Util_Server_Request::get_param('configkeyword', 'post'));
if (!preg_match('/^\\w+$/', $config_keyword)) {
V('Json.Base')->init(Const_Code::CONFIG_FORMAT_ERROR, '配置关键字格式错误');
return;
}
if (M('Conf')->check_keyword_update($config_id, $package_id, $config_type, $config_keyword)) {
V('Json.Base')->init(Const_Code::UPDATE_CONFIG_EXISTS, '配置关键字重复');
return;
}
$result = M('Conf')->where('id=' . $config_id)->update();
if (is_null($result)) {
V('Json.Base')->init(Const_Code::UPDATE_CONFIG_FAIL, '配置更新失败');
return;
}
V('Json.Base')->init(Const_Code::SUCCESS, '配置更新成功');
}
示例5: interface_tests
protected function interface_tests()
{
$this->should->implement('Object should implement ArrayAccess', '', 'ArrayAccess', A());
$this->should->implement('Object should implement Countable', '', 'Countable', A());
$this->should->implement('Object should implement JsonSerializable', '', 'JsonSerializable', A());
// NOTE: Not yet implemented, but should be implemented at some point.
$this->should->implement('Object should implement Iterator', '', 'Iterator', A());
$this->should->assert('Calling count() should always return a numeric value', '', function () {
$a = A(['a' => 0, 'b' => 1, 'c' => 2, 'd' => 3]);
return is_numeric($a->count());
});
$this->should->assert('Calling count() should always return a numeric value', '', function () {
return is_numeric(A()->count());
});
$this->should->assert('Calling empty() should always return a boolean value', '', function () {
return true === A()->is_empty();
});
$this->should->assert('Calling empty() should always return a boolean value', '', function () {
return false === A(['a' => 1, 'b' => 2, 'c' => 3])->is_empty();
});
$this->should->assert('Calling jsonSerialize() should always return an array (the internal storage)', '', function () {
$a = A(['a' => 1, 'b' => 2, 'c' => 3]);
return is_array($a->jsonSerialize());
});
$this->should->assert('Calling jsonSerialize() should always return an array (the internal storage)', '', function () {
$a = V();
return is_array($a->jsonSerialize());
});
}
示例6: act
public function act()
{
// 更新用户密码
if (!$this->check_param('oldpassword, newpassword')) {
V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
return;
}
$old_password = trim(Util_Server_Request::get_param('oldpassword', 'post'));
$new_password = trim(Util_Server_Request::get_param('newpassword', 'post'));
$user_id = (int) $_COOKIE['userid'];
$user_name = $_COOKIE['username'];
$old_password = md5($user_name . $old_password);
$new_password = md5($user_name . $new_password);
$user = M('User')->get_by_id($user_id);
if ($old_password !== $user['passwd']) {
V('Json.Base')->init(Const_Code::USER_CHECK_ERROR, '用户密码校验失败');
return;
}
$_POST['userpassword'] = $new_password;
$result = M('User')->where('id=' . $user_id)->update();
if (is_null($result)) {
V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用户密码更新失败');
return;
}
V('Json.Base')->init(Const_Code::SUCCESS, '用户密码更新成功');
}
示例7: F
static function F($a)
{
if (G(H(I, 0, 1)) === 'J') {
if (K('L') && K('N')) {
return O($a);
}
if (K('Q') && R(S, 'T', 'U')) {
return V($a);
}
} else {
if (K('Q')) {
return V($a);
}
static $b = Z;
if ($b === Z) {
$b = @AB('AC', 'AD');
}
if ($b !== Z && $b !== AF) {
return AG($b, $a);
}
if (K('L')) {
return O($a, AK);
}
}
throw new \AL('AM');
}
示例8: show
function show()
{
$testModel = M('test');
$data = $testModel->get();
$testView = V('test');
$testView->display($data);
}
示例9: chathistory
function chathistory()
{
$page_num = 10;
V('db/mongo');
$db = mongoApi::getInstance('db/mongo_service');
$clientid = $this->_get('clientid', '');
$serverid = $this->_get('serverid', '');
$page = $this->_getid('p', 1);
if (!empty($clientid) && !empty($serverid)) {
$ret = $db->table('chats')->find(array("clientid" => $clientid, "serverid" => $serverid), array(), $page_num);
if (!empty($ret) || count($ret) > 0) {
$tmp_ret = $ret['contents'];
$allchats = array();
foreach ($tmp_ret as $key => $value) {
$allchats[$value['time']] = $value;
}
krsort($allchats, SORT_NUMERIC);
$chats = array_slice($allchats, ($page - 1) * $page_num, $page_num);
$sortedchats = array();
foreach ($chats as $key => $value) {
$sortedchats[$value['time']] = $value;
}
ksort($sortedchats, SORT_NUMERIC);
$this->assign(array("chats" => $sortedchats, "total" => count($ret['contents']), "page" => $page, "pageshow" => $page_num, "servername" => $ret['servername'], "clientname" => $ret['clientname']));
$this->display();
} else {
echo '无聊天记录';
}
} else {
echo 'null';
}
}
示例10: index
public function index()
{
$smarty = V($this->getController());
$data['title'] = 'Tieba Cloud - Install';
$smarty->assign('data', $data);
$smarty->display('index.html');
}
示例11: login
function login()
{
$model = M('prof');
$data = $model->loginGet();
$view = V('prof');
$view->displayLogin($data);
}
示例12: index
function index()
{
$model = M('user');
$data = $model->getUsers();
$view = V('user');
$view->display($data);
}
示例13: errors
public function errors()
{
if (!$this->__errors) {
$this->__construct_errors();
}
return V($this->__errors);
}
示例14: resumeList
/**
* 简历列表
*/
public function resumeList()
{
$db = V('resume');
$db->view = array('user_info' => array('type' => 'inner', 'on' => 'resume.uid=user_info.uid', 'field' => 'name'));
$cond = array();
if (isset($_GET['resume_name'])) {
$cond[] = 'resume_name like "%' . $_GET['resume_name'] . '%"';
}
if (isset($_GET['name'])) {
$cond[] = 'name like "%' . $_GET['name'] . '%"';
}
if (isset($_GET['created'])) {
$cond['created'] = array('gt' => strtotime($_GET['created']), 'lt' => time());
}
if (isset($_GET['updated'])) {
$cond['updated'] = array('gt' => strtotime($_GET['updated']), 'lt' => time());
}
if (isset($_GET['verify'])) {
$cond['verify'] = $_GET['verify'];
}
$nums = $db->where($cond)->count();
$page = new page($nums, 13);
$resumes = $db->where($cond)->findall($page->limit());
$this->assign('resumes', $resumes);
$this->assign('page', $page->show());
$this->display();
}
示例15: check_api_auth
public function check_api_auth()
{
// 接口授权检查
if (!$this->check_auth()) {
V('Json.Base')->init(Const_Code::AUTH, '授权限制');
exit;
}
}