当前位置: 首页>>代码示例>>PHP>>正文


PHP model::field方法代码示例

本文整理汇总了PHP中model::field方法的典型用法代码示例。如果您正苦于以下问题:PHP model::field方法的具体用法?PHP model::field怎么用?PHP model::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model::field方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doManagefield

 function doManagefield()
 {
     $mid = (int) $_GET['id'];
     $FieldArray = model::field($mid);
     $model = model::data($mid);
     $fArray = explode(',', $model['field']);
     include admincp::tpl();
 }
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:8,代码来源:models.mo.php

示例2: db

 public function db()
 {
     jiashu::loadLib('model');
     $user = new model('user', 'testdb');
     //$r = $user->executeSql('select * from test_user');//you can use executeSql() to query a SQL statment directly.用executeSql()函数可以直接执行SQL语句
     $r = $user->field('username,email')->limit('1')->query();
     JSFW()->setTplData('r', $r);
     JSFW()->render('index');
 }
开发者ID:gusen,项目名称:jiashu,代码行数:9,代码来源:index.php

示例3: dosave

 function dosave()
 {
     include_once iPATH . 'include/tag.class.php';
     $id = $_POST['id'];
     $mid = $_POST['mid'];
     $FArray = model::field($mid);
     $model = model::data($mid);
     $content = array();
     if ($_POST['content']) {
         foreach ($_POST['content'] as $field => $value) {
             if (model::isDefField($field)) {
                 switch ($field) {
                     case "userid":
                         $value = intval($value);
                         break;
                     case "fid":
                         $value = $fid = intval($value);
                         empty($value) && javascript::alert('请选择所属栏目');
                         break;
                     case "orderNum":
                         $value = _int($value);
                         break;
                     case "top":
                         $value = _int($value);
                         break;
                     case "title":
                         $value = dhtmlspecialchars($value);
                         empty($value) && javascript::alert('标题不能为空!');
                         break;
                     case "editor":
                         $value = dhtmlspecialchars($value);
                         break;
                     case "tags":
                         $value = iTAG::split(dhtmlspecialchars($value), true);
                         break;
                     case "type":
                         $value = intval($value);
                         break;
                     case "vlink":
                         $value = implode(',', $value);
                         break;
                     case "postype":
                         $value = empty($value) ? intval($value) : "1";
                         break;
                     case "pubdate":
                         $value = _strtotime($value);
                         break;
                     case "clink":
                         $value = dhtmlspecialchars($value);
                         if ($value) {
                             $clinklen = strlen($value);
                             for ($i = 0; $i < $clinklen; $i++) {
                                 !preg_match("/[a-zA-Z0-9_\\-~" . preg_quote($this->iCMS->config['CLsplit'], '/') . "]/", $value[$i]) && javascript::alert('自定链接只能由英文字母、数字或_-~组成(不支持中文)');
                             }
                         }
                         break;
                 }
             } elseif ($F = $FArray[$field]) {
                 switch ($F['type']) {
                     case "number":
                         $value = intval($value);
                         break;
                     case "calendar":
                         $value = _strtotime($value);
                         break;
                     case in_array($F['type'], array('text', 'textarea', 'radio', 'select', 'email', 'url', 'image', 'upload')):
                         $value = dhtmlspecialchars($value);
                         break;
                     case in_array($F['type'], array('checkbox', 'multiple')):
                         $value = implode(',', $value);
                         break;
                     case 'editor':
                         $this->iCMS->config['autoformat'] && ($value = autoformat($value));
                         break;
                     default:
                         $value = dhtmlspecialchars($value);
                 }
             }
             WordFilter($value) && javascript::alert($field . '字段包含被系统屏蔽的字符,请返回重新填写。');
             $content[$field] = $value;
             $PF[] = $field;
         }
     }
     if (empty($content['clink'])) {
         include iPATH . 'include/cn.class.php';
         $content['clink'] = CN::pinyin($content['title'], $this->iCMS->config['CLsplit']);
     }
     $table = model::tbn($_POST['table']);
     $MF = explode(',', $model['field']);
     $diff = array_diff_values($PF, $MF);
     if ($diff['-']) {
         foreach ($diff['-'] as $field) {
             $content[$field] = '';
         }
     }
     //缺少的字段 填认空值
     $SELFURL = __SELF__ . (empty($_POST['REFERER']) ? '?mo=content&do=manage' : $_POST['REFERER']);
     $forum = new forum();
     if (empty($id)) {
         empty($content['userid']) && ($content['userid'] = member::$uId);
//.........这里部分代码省略.........
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:101,代码来源:content.mo.php

示例4: delContent

function delContent($id, $mid, $uid = '0', $postype = '1')
{
    $uid && ($sql = "and `userid`='{$uid}' and `postype`='{$postype}'");
    $model = model::data($mid);
    $table = $model['tbn'];
    $FArray = model::field($mid);
    $MF = explode(',', $model['field']);
    $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` where `id`='{$id}' {$sql}", ARRAY_A);
    foreach ($MF as $field) {
        if ($FArray[$field]['type'] == 'upload') {
            $rs[$field] && ($msg .= delpic($rs[$field]));
        }
    }
    $rs['tags'] && ($msg .= deltag($rs['tags']));
    iCMS_DB::query("DELETE FROM `#iCMS@__comment` WHERE indexId='{$id}' and mid='{$mid}'");
    $msg .= '评论数据删除…<span style=\'color:green;\'>√</span><br />';
    iCMS_DB::query("DELETE FROM `#iCMS@__{$table}` WHERE id='{$id}'");
    iCMS_DB::query("DELETE FROM `#iCMS@__vlink` WHERE indexId='{$id}' AND modelId='{$mid}'");
    $msg .= '内容数据删除…<span style=\'color:green;\'>√</span><br />';
    iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count-1 WHERE `fid` ='" . $rs['fid'] . "' LIMIT 1");
    $msg .= '栏目数据更新…<span style=\'color:green;\'>√</span><br />';
    $msg .= '删除完成…<span style=\'color:green;\'>√</span><hr />';
    return $msg;
}
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:24,代码来源:function.php


注:本文中的model::field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。