本文整理汇总了PHP中u函数的典型用法代码示例。如果您正苦于以下问题:PHP u函数的具体用法?PHP u怎么用?PHP u使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了u函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("mail_server");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['smtp_server'])) {
$this->error(L("SMTP_SERVER_EMPTY_TIP"));
}
if (!check_empty($data['smtp_name'])) {
$this->error(L("SMTP_NAME_EMPTY_TIP"));
}
if (!check_empty($data['smtp_pwd'])) {
$this->error(L("SMTP_PWD_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:bharatthakkar,项目名称:stock-crowd-funding-system,代码行数:28,代码来源:MailServerAction.class.php
示例2: testOrderDesc
public function testOrderDesc()
{
$this->assertTrue(CComparator::orderDesc(u("Hello there!"), u("Hello there!")) == 0);
$this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0);
$this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0);
$this->assertTrue(CComparator::orderDesc(u("¡Hola señor!"), u("¡Hola señor!")) == 0);
$this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0);
$this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0);
$this->assertTrue(CComparator::orderDesc(a("a", "b", "c"), a("a", "b", "c")) == 0);
$this->assertTrue(CComparator::orderDesc(a("b", "b", "c"), a("a", "b", "c")) < 0);
$this->assertTrue(CComparator::orderDesc(m(["one" => "a", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) == 0);
$this->assertTrue(CComparator::orderDesc(m(["one" => "b", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) < 0);
$this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1955 12:00:00 PST")) == 0);
$this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) > 0);
$this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1985 12:00:01 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) < 0);
$this->assertTrue(CComparator::orderDesc(true, true) == 0);
$this->assertTrue(CComparator::orderDesc(false, true) > 0);
$this->assertTrue(CComparator::orderDesc(true, false) < 0);
$this->assertTrue(CComparator::orderDesc(1234, 1234) == 0);
$this->assertTrue(CComparator::orderDesc(1234, 5678) > 0);
$this->assertTrue(CComparator::orderDesc(5678, 1234) < 0);
$this->assertTrue(CComparator::orderDesc(12.34, 12.34) == 0);
$this->assertTrue(CComparator::orderDesc(12.34, 56.78) > 0);
$this->assertTrue(CComparator::orderDesc(56.78, 12.34) < 0);
$this->assertTrue(CComparator::orderDesc(null, null) == 0);
$this->assertTrue(CComparator::orderDesc("Hello there!", "Hello there!") == 0);
$this->assertTrue(CComparator::orderDesc("A", "B") > 0);
$this->assertTrue(CComparator::orderDesc("C", "B") < 0);
$this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("a", "b", "c")) == 0);
$this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("b", "b", "c")) > 0);
$this->assertTrue(CComparator::orderDesc(CArray::fromElements("b", "b", "c"), CArray::fromElements("a", "b", "c")) < 0);
$this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) == 0);
$this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "b", "two" => "b", "three" => "c"]) > 0);
$this->assertTrue(CComparator::orderDesc(["one" => "b", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) < 0);
}
开发者ID:nunodotferreira,项目名称:Phred,代码行数:35,代码来源:CComparatorTest.php
示例3: testWrite
public function testWrite()
{
$filePath = CFile::createTemporary();
CFile::write($filePath, "Hello there!");
$this->assertTrue(u(file_get_contents($filePath))->equals("Hello there!"));
CFile::delete($filePath);
}
开发者ID:nunodotferreira,项目名称:Phred,代码行数:7,代码来源:CFileTest.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: getAdminInterface
/**
* Build and return admin interface
*
* Any module providing an admin interface is required to have this function, which
* returns a string containing the (x)html of it's admin interface.
* @return string
*/
function getAdminInterface()
{
$this->addCSS('/modules/Templater/css/templates.css');
$templates = Template::getAllTemplates();
if (!isset($_REQUEST['template_id'])) {
$this->smarty->assign('curtemplate', $templates[0]);
} else {
if (isset($_REQUEST['save'])) {
$t = new Template($_REQUEST['template_id']);
$t->setData(u($_REQUEST['editor']));
$t->setTimestamp(date('Y-m-d H:i:s'));
$t->setId(null);
$t->save();
$this->smarty->assign('curtemplate', $t);
$templates = Template::getAllTemplates();
} else {
if (isset($_REQUEST['switch_template'])) {
$this->smarty->clear_assign('curtemplate');
$this->smarty->assign('curtemplate', new Template($_REQUEST['template']));
} else {
if (isset($_REQUEST['switch_revision'])) {
$this->smarty->clear_assign('curtemplate');
$this->smarty->assign('curtemplate', new Template($_REQUEST['revision']));
} else {
$this->smarty->assign('curtemplate', new Template($_REQUEST['template_id']));
}
}
}
}
$this->smarty->assign('templates', $templates);
return $this->smarty->fetch('admin/templates.tpl');
}
开发者ID:swat30,项目名称:safeballot,代码行数:39,代码来源:Templater.php
示例6: insert
public function insert()
{
B('FilterString');
$ajax = intval($_REQUEST['ajax']);
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error("请输入分类名称");
}
$user_level_list = M(MODULE_NAME)->where("point=" . intval($data['point']))->find();
if ($user_level_list) {
$this->error('已有相同的"所需信用值"');
}
// 更新数据
$log_info = $data['name'];
$list = M(MODULE_NAME)->add($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("INSERT_SUCCESS"), 1);
$this->success(L("INSERT_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("INSERT_FAILED"), 0);
$this->error(L("INSERT_FAILED"));
}
}
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:27,代码来源:UserLevelAction.class.php
示例7: update
public function update()
{
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/add"));
if (!check_empty($data['name'])) {
$this->error(L("TAGNAME_EMPTY_TIP"));
}
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
$log_info = $data['name'];
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
M("TagGroupLink")->where("tag_group_id=" . $data['id'])->delete();
foreach ($_REQUEST['cate_id'] as $cate_id) {
if (intval($cate_id) > 0) {
$link_data = array();
$link_data['category_id'] = intval($cate_id);
$link_data['tag_group_id'] = $data['id'];
M("TagGroupLink")->add($link_data);
}
}
clear_auto_cache("store_filter_nav_cache");
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:32,代码来源:TagGroupAction.class.php
示例8: update
public function update()
{
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("levelname");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['levelname'])) {
$this->error("请填写星级名称");
}
if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $data['level'])) {
$this->error("请填写级别");
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
$dbErr = M()->getDbError();
save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0);
$this->error(L("UPDATE_FAILED") . $dbErr);
}
}
开发者ID:macall,项目名称:baikec_jsd,代码行数:25,代码来源:ServiceLevelAction.class.php
示例9: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = $data['id'] . l("TOPIC_DATA");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
rm_auto_cache("recommend_forum_topic");
M("TopicCateLink")->where("topic_id=" . $data['id'])->delete();
foreach ($_REQUEST['cate_id'] as $cate_id) {
$link_data = array();
$link_data['cate_id'] = $cate_id;
$link_data['topic_id'] = $data['id'];
M("TopicCateLink")->add($link_data);
}
syn_topic_match($data['id']);
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:macall,项目名称:jsd,代码行数:28,代码来源:TopicAction.class.php
示例10: update
public function update()
{
$data = M(MODULE_NAME)->create();
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit"));
if (!check_empty($data['name'])) {
$this->error(L("POINTNAME_EMPTY_TIP"));
}
if (M(MODULE_NAME)->where("id<>" . $data['id'] . " and `name`='" . $data['name'] . "'")->count() > 0) {
$this->error(L("HAD_POINTGROUP"));
}
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
$log_info = $data['name'];
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:25,代码来源:PointGroupAction.class.php
示例11: pagesList
function pagesList($type)
{
global $self, $PG_DIR;
$list = array();
$dir = opendir($PG_DIR);
while ($file = readdir($dir)) {
if (preg_match("/\\.txt\$/", $file)) {
$files[] = substr($file, 0, strlen($file) - 4);
}
}
if (is_array($files)) {
sort($files);
foreach ($files as $file) {
$list[] = "<a href=\"{$self}?page=" . u($file) . "\">" . h($file) . "</a>";
}
}
if ($type == "comma") {
$ret = implode(", ", $list);
} else {
if ($type == "list") {
$ret = "<ul><li>" . implode("</li><li>", $list) . "</li></ul>";
}
}
return $ret;
}
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:25,代码来源:wkp_Index.php
示例12: order_referer
/**
* 订单来路的图饼展示
*/
public function order_referer()
{
$where = " 1=1 ";
$where .= " and type <> 1";
$map['type'] = array("neq", 1);
$begin_time = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
$end_time = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
if ($end_time == 0) {
$where .= " and create_time > " . $begin_time;
$map['create_time'] = array("gt", $begin_time);
} else {
$where .= " and create_time between " . $begin_time . " and " . $end_time;
$map['create_time'] = array("between", array($begin_time, $end_time));
}
$sql = "select referer,count(id) as ct from " . DB_PREFIX . "deal_order where " . $where . " and referer <> '' group by referer having count(id) > 0 order by ct desc limit 8 ";
$total_sql = "select count(*) from " . DB_PREFIX . "deal_order where " . $where;
$colors = array("0xAAAAAA", "0x669999", "0xBBBB55", "0xCC6600", "0x9999FF", "0x0066CC", "0x99CCCC", "0x999999", "0xFFCC00", "0x009999", "0x99CC33", "0xFF9900", "0x999966", "0x66CCCC", "0x339966", "0xCCCC33");
$total = intval($GLOBALS['db']->getOne($total_sql));
$list = $GLOBALS['db']->getAll($sql);
$items = array();
foreach ($list as $k => $v) {
$total -= intval($v['ct']);
$items[] = array("value" => intval($v['ct']), "tip" => $v['referer'], "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => $v['referer'])) . "')");
}
$items[] = array("value" => $total, "tip" => "直接访问", "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => -1)) . "')");
$data['bg_colour'] = "#ffffff";
$data['elements'] = array(array("type" => "pie", "colours" => $colors, "alpha" => 1, "border" => 2, "start-angle" => 35, "values" => $items));
ajax_return($data);
}
开发者ID:macall,项目名称:jsd,代码行数:32,代码来源:OfcAction.class.php
示例13: update
public function update()
{
B('FilterString');
$data = M("ApnsMessages")->create();
$log_info = $data['id'];
//开始验证有效性
$this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
if (!check_empty($data['content'])) {
$this->error(L("CONTENT_EMPTY_TIP"));
}
if ($data['send_time'] == '') {
$data['send_time'] = get_gmtime();
}
$data['send_time'] = to_timespan($data['send_time']);
if (intval($_REQUEST['resend']) == 1) {
$data['status'] = 0;
}
$list = M("ApnsMessages")->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:28,代码来源:MApnsAction.class.php
示例14: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$user_names = preg_split("/[ ,]/i", $data['user_names']);
$user_ids = "";
foreach ($user_names as $k => $v) {
$uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
if ($uid) {
$user_ids .= $uid . "|";
}
}
$data['user_ids'] = $user_ids;
$data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['title'])) {
$this->error(L("MSY_TITLE_EMPTY_TIP"));
}
if (!check_empty($data['content'])) {
$this->error(L("MSY_CONTENT_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:35,代码来源:MsgSystemAction.class.php
示例15: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['name'])) {
$this->error(L("ATTR_NAME_EMPTY_TIP"));
}
if (!check_empty($data['preset_value']) && $data['input_type'] == 1) {
$this->error(L("PRESET_VALUE_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
开发者ID:macall,项目名称:jsd,代码行数:25,代码来源:GoodsTypeAttrAction.class.php
示例16: displayCatalog
function displayCatalog($catalog, &$lnk, $deep = 0, $count)
{
//
foreach ($catalog->{u('Группа')} as $group) {
$d = array('id' => u2w($group->{u('Ид')}), 'name' => u2w($group->{u('Наименование')}));
?>
<tr>
<td style="padding-left:<?php
echo $deep * 20;
?>
px;">
<?php
echo $d['name'];
?>
<?php
//=print_r($count)
?>
<?php
if (!empty($count[$d['id']])) {
?>
[<?php
echo $count[$d['id']];
?>
]<?php
}
?>
</td>
<td>
<input style="font-size:7pt;width:50px" name="lnk[<?php
echo $d['id'];
?>
]" value="<?php
echo !empty($lnk[$d['id']]) ? $lnk[$d['id']] : '';
?>
">
</td>
<td style="white-space:nowrap">
<?php
echo $d['id'];
?>
</td>
<td>
<?php
/*a class="move" rel="<?=$d['id']?>" title="Переместить дочерние узлы" href="#"><img src="/img/pic/move_16.gif"/></a*/
?>
<a class="move_to" rel="<?php
echo $d['id'];
?>
" title="Переместить дочерние узлы в текущий каталог" href="#"><img src="/img/pic/move_16.gif"/></a>
</td>
</tr>
<?php
if (!empty($group->{u('Группы')})) {
displayCatalog($group->{u('Группы')}, $lnk, $deep + 1, $count);
}
}
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:58,代码来源:admin_catsrv_extcat_1c.tpl.php
示例17: get_is_default
function get_is_default($status, $id)
{
if ($status == 1) {
$str = l("IS_DEFAULT_" . $status);
} else {
$str = l("IS_DEFAULT_" . $status) . " <a href='" . u("DealCity/set_default", array("id" => $id)) . "' style='color:red;'>" . l("SET_DEFAULT") . "</a>";
}
return $str;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:9,代码来源:7156e770f1e0ebddb613ffa14f5ca231.php
示例18: __construct
/**
* Constructor
*/
public function __construct()
{
// the config object
$config = Zend_Registry::get('config')->social->vk;
// auth uri
$urn = MyProject_Utils_Client::getUrl() . u(array(), 'vkontakte', true);
// parent one
parent::__construct($config->id, $config->key, $urn, 'offline');
}
开发者ID:noglance,项目名称:ZF-Vkontakte-SDK,代码行数:12,代码来源:singleton.php
示例19: logout
public function logout()
{
if (isset($_SESSION['admin_info'])) {
unset($_SESSION['admin_info']);
$this->success('退出登录成功!', u('Login/index'));
} else {
$this->error('已经退出登录!');
}
}
开发者ID:Molly2Molly,项目名称:fiance,代码行数:9,代码来源:LoginAction.class.php
示例20: main
public function main()
{
if (count(u()->getUriInfo()->getUrlList()) == 1) {
$this->__lib('VersionUpdate');
(new VersionUpdate())->update_script();
$this->__view("Control/main.php");
} else {
$this->__view("Control/main_show.php");
}
}
开发者ID:ttym7993,项目名称:Linger,代码行数:10,代码来源:Control.php
注:本文中的u函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论