本文整理汇总了PHP中MY_Model::readByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::readByPk方法的具体用法?PHP MY_Model::readByPk怎么用?PHP MY_Model::readByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::readByPk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readByPk
public function readByPk($pk, $col = NULL)
{
if (!is_numeric($pk)) {
// try to catch the situation when the $pk is null
return FALSE;
} else {
return parent::readByPk($pk, $col);
}
}
示例2: getPackageIdFromBlockID
public function getPackageIdFromBlockID($block_id)
{
if ($block_id != NULL) {
$block_info = parent::readByPk($block_id, ["pid"]);
if ($block_info != NULL) {
return $block_info["pid"];
}
}
return FALSE;
}
示例3: addGidIntoExpr
public function addGidIntoExpr($expr_id, $gid = NULL)
{
if (!isset($gid) || !empty($gid) || parent::count(["gid" => $gid]) > 0) {
$gid = $this->next_gid();
}
$data = parent::readByPk($expr_id, $this->fields);
if ($data) {
$data["gid"] = $gid;
$data["is_forked"] = TRUE;
// create
return parent::create($data);
} else {
$this->err_msg = "Invalid Experiment ID";
$this->err_code = 404;
return FALSE;
}
}
示例4: getUserInfo
/**
* Get user Information
*/
public function getUserInfo($pid)
{
//check permission
if ($this->is_login() === TRUE) {
if ($this->pid == $pid || $this->pid == 0) {
return parent::readByPk($pid);
} else {
return $this->set_err(400, "No permission: You can't see the information of another user");
}
} else {
return $this->set_err(400, "No permission: haven't logged in yet~");
}
}