本文整理汇总了PHP中uuid函数的典型用法代码示例。如果您正苦于以下问题:PHP uuid函数的具体用法?PHP uuid怎么用?PHP uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uuid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the job.
*
* @return bool
*/
public function handle()
{
// Set the inquiry model data.
$this->inquiry->user_id = auth()->id();
$this->inquiry->uuid = uuid();
$this->inquiry->category_id = $this->category->id;
$this->inquiry->title = $this->request->input('title');
$this->inquiry->description = $this->request->input('description');
if ($this->category->manager === true) {
// If the category requires manager approval, we'll retrieve the manager record.
$manager = User::whereHas('roles', function (Builder $query) {
$query->whereName('managers');
})->findOrFail($this->request->input('manager'));
$this->inquiry->manager_id = $manager->id;
// We'll send the manager a notification.
$notification = new Notification($manager, 'emails.inquiries.created', ['inquiry' => $this->inquiry], function (Message $message) use($manager) {
$message->subject('A New Request Requires Your Approval');
$message->to($manager->email);
});
}
if ($this->inquiry->save()) {
// If the inquiry was successfully created, we'll
// send out the notification if one has been set.
if (isset($notification)) {
$this->dispatch($notification);
}
return true;
}
return false;
}
示例2: signup
function signup($post, $connect)
{
if (!empty($post['mail']) && !empty($post['password1']) && !empty($post['password1'])) {
if (preg_match('/@.+\\./', $post['mail'])) {
$sql = "SELECT uuid, mail, password, create_at, rank, accesstoken FROM users WHERE mail='" . htmlspecialchars($post['mail']) . "'";
$result = mysqli_query($connect, $sql);
if (mysqli_num_rows($result) == 0) {
if ($post['password1'] === $post['password2']) {
$sql = "INSERT INTO users (uuid, mail, password, rank, create_at)\n\t\t\t\t\t\tVALUES ('" . uuid() . "', '" . $post['mail'] . "', '" . pass_hash($post['mail'], $post['password1']) . "', 0, NOW())";
if (mysqli_query($connect, $sql)) {
$_SESSION['error'] = "";
return true;
} else {
$_SESSION['error'] = "Une erreur est survenue.";
}
} else {
$_SESSION['error'] = "Les mots de passes de correspondent pas.";
}
} else {
$_SESSION['error'] = "L'adresse email est déjà prise.";
}
} else {
$_SESSION['error'] = "L'adresse email doit être correctement formatée.";
}
}
return false;
}
示例3: tracking
public function tracking()
{
// if we have a hash in get parameters and it is active, we create a new tracking log
if (Request::has('h')) {
$track = Tracking::getByHash(Request::input('h'));
if ($track->isActive()) {
$data = ['tracking_id' => $track->tracking_id, 'data' => json_encode(Request::except('h'))];
Tracking::log($data);
}
}
// if we have a mail_id, we update the mail status and the date where it is opened
if (Request::has(Tracking::MAIL_ID)) {
if (Mail::exists(uuid('bytes', Request::input(Tracking::MAIL_ID)))) {
$mail = Mail::getById(uuid('bytes', Request::input(Tracking::MAIL_ID)));
if ($mail->mail_status_id != Mail::STATUS_OPENED) {
$mail->mail_status_id = Mail::STATUS_OPENED;
$mail->opened_at = Carbon::now();
$mail->save();
}
}
}
header('Content-type:image/jpg');
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
header("Expires: 0");
exit;
}
示例4: persist
/**
* Persist the changes.
*
* @param PasswordFolder $folder
*
* @return bool
*/
public function persist(PasswordFolder $folder)
{
$folder->user_id = Auth::user()->id;
$folder->locked = true;
$folder->uuid = uuid();
$folder->pin = $this->input('pin');
return $folder->save();
}
示例5: save
/**
* saves current search
*
* @param string $name name to save search as
* @param integer $tabledefid table definition's id
* @param string $userid uuid of user
*/
function save($name, $tabledefid, $userid)
{
$uuid = getUuid($this->db, "tbld:5c9d645f-26ab-5003-b98e-89e9049f8ac3", $tabledefid);
$querystatement = "\n SELECT\n `prefix`\n FROM\n `tabledefs`\n WHERE\n `uuid` = '" . $uuid . "'";
$queryresult = $this->db->query($querystatement);
$therecord = $this->db->fetchArray($queryresult);
$prefix = $therecord["prefix"];
$insertstatement = "\n INSERT INTO\n usersearches\n (\n userid,\n tabledefid,\n name,\n `type`,\n sqlclause,\n `uuid`\n ) VALUES (\n '" . mysql_real_escape_string($userid) . "',\n '" . mysql_real_escape_string($uuid) . "',\n '" . mysql_real_escape_string($name) . "',\n 'SCH',\n '" . addslashes($_SESSION["tableparams"][$tabledefid]["querywhereclause"]) . "',\n '" . uuid($prefix . ":") . "'\n )";
$this->db->query($insertstatement);
echo "search saved";
}
示例6: intellispireNetworkClient
function intellispireNetworkClient($repository, $channels, $isnid = null, $machineid = null)
{
$this->repository = $repository;
$this->isnid = new isnid($isnid);
$this->channels = $channels;
if ($machineid) {
$this->machineid = $machineid;
} else {
$this->machineid = uuid();
}
}
示例7: check_uuid
public function check_uuid()
{
$uuid = C('version', 'uuid');
if (!empty($uuid)) {
return $uuid;
} else {
$uuid = uuid(C('version', 'product') . '-');
\Leaps\Base\Config::modify('version', array('uuid' => $uuid));
return $uuid;
}
}
示例8: let
function let()
{
$config = new Config();
$config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel1'), path('/tmp', uuid(), 'channel1.log'));
$config->set(MonologConfig::LOG_CHANNEL_FILE_PATH('channel2'), path('/tmp', uuid(), 'channel2.log'));
$config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('channel1'), 'debug');
$config->set(MonologConfig::LOG_CHANNEL_LOG_LEVEL('channel2'), 'debug');
$config->set(MonologConfig::DEFAULT_CHANNEL_NAME, 'channel1');
$monologConfig = new MonologConfig($config);
$this->beConstructedWith($monologConfig);
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['vote' => 'required|array|vote_count|vote_unique|sane_votes']);
$user = $request->user();
if ($user->uuid === null) {
$user->update(['uuid' => uuid()]);
}
foreach ($request->get('vote') as $vote) {
Vote::create(['candidate_id' => Candidate::findOrFail($vote)->id, 'user_id' => $user->id, 'term_id' => nextTerm()->id]);
}
Session::flash('message', 'Your votes were successfully counted.');
return redirect('/');
}
示例10: handle
/**
* Execute creating a new batch.
*
* @return bool|Batch
*/
public function handle()
{
$batch = new Batch();
$batch->locked = false;
$batch->session_id = Session::getId();
$batch->uuid = uuid();
$batch->lifetime = $this->lifetime;
$batch->description = $this->description;
$batch->name = $this->name;
if ($batch->save()) {
return $batch;
}
return false;
}
示例11: insertAndSetId
/**
* Insert the given attributes and set the ID on the model.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param array $attributes
* @return void
*/
protected function insertAndSetId(Builder $query, $attributes)
{
$keyName = $this->getKeyName();
// uuid management
if ($this->uuid) {
$id = uuid();
$attributes[$keyName] = $id;
$query->insert($attributes);
// auto increment
} else {
$id = $query->insertGetId($attributes, $keyName);
}
$this->setAttribute($keyName, $id);
}
示例12: addAction
function addAction()
{
$bind['proName'] = $_POST['proName'];
$bind['proPrice'] = $_POST['proPrice'];
$imagename = $_FILES['proImage']['name'];
$error = $_FILES['proImage']['error'];
$tmpname = $_FILES['proImage']['tmp_name'];
$bind['proImage'] = uuid() . '.' . getExtesion($imagename);
if ($error === UPLOAD_ERR_OK) {
move_uploaded_file($tmpname, '../proimages/' . $bind['proImage']);
}
insert('products', $bind);
$message = '添加成功';
$redirect = '<a href="addPro.html">继续添加</a>/<a href="listPro.php">返回列表页面</a>';
require_once 'thems/a.html';
}
示例13: create
/**
* Create new file and return file key (id)
*
* @param string $fileName [optional]
* @param string $content [optional]
* @return string key
*/
public function create($fileName = null, $content = null)
{
// Create new key
$key = sha1(uuid());
// Create data file
$dataFilename = $this->getDataFileName($key);
$this->touchFile($dataFilename);
$this->write($key, $content);
// Create info file
$info = array('filename' => $fileName, 'datafile' => $dataFilename);
$infoFilename = $this->getInfoFileName($key);
$this->touchFile($infoFilename);
$this->setInfo($key, $info);
$this->keys[] = $key;
return $key;
}
示例14: addAdminuserHandle
public function addAdminuserHandle()
{
// p($_POST);
// $a=uniqid();
// $a=md5(time() . mt_rand(1,1000000));
$username = trim($_POST['UserName']);
$password = trim($_POST['PassWord']);
$confirmpassword = trim($_POST['ConfirmPassWord']);
$admuser = M('adminusers');
$data['AdminUserToken'] = trim(uuid(), '{' . '}');
$data['UserName'] = $username;
$data['PassWord'] = sha1($password);
if ($password != $confirmpassword) {
$this->error("两次密码输入不一致,请重新输入");
} elseif ($username == '' || $password == '' || $confirmpassword == '') {
$this->error("用户名或密码不能为空!");
} elseif ($admuser->add($data)) {
// p($data);
// die();
$this->success('管理员添加成功!');
}
}
示例15: user_info
/**
* 用户信息管理
* @param string $name
* @param string $value
* @return mix
*/
function user_info($name = '', $value = '')
{
$time = 3600 * 24;
$key = cookie('identity');
if (!$key) {
$key = uuid();
cookie('identity', $key, array('httponly' => true));
}
$info = S($key);
//清除数据
if ($name === null) {
S($key, null);
return null;
}
if (empty($value)) {
if (empty($name)) {
return $info;
}
if (isset($info[$name])) {
return $info[$name];
}
} else {
if (empty($name)) {
$info = $value;
if (isset($info['password'])) {
unset($info['password']);
}
if (isset($info['encrypt'])) {
unset($info['encrypt']);
}
} else {
$info[$name] = $value;
}
S($key, $info, $time);
}
return null;
}