本文整理汇总了PHP中Phone类的典型用法代码示例。如果您正苦于以下问题:PHP Phone类的具体用法?PHP Phone怎么用?PHP Phone使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendOrders
public function sendOrders()
{
set_time_limit(60000);
try {
$user = User::find(5);
if ($user->u_priase_count == 0) {
throw new Exception("已经执行过了", 30001);
} else {
$user->u_priase_count = 0;
$user->save();
}
$str_text = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550';
$str_push = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550';
$orders = Order::selectRaw('right(`t_orders`.`o_number`, 4) AS seed, `t_orders`.*')->join('carts', function ($q) {
$q->on('orders.o_id', '=', 'carts.o_id');
})->where('carts.c_type', '=', 2)->where('carts.p_id', '=', 4)->orderBy('seed', 'DESC')->limit(111)->get();
foreach ($orders as $key => $order) {
if (empty($order)) {
continue;
}
$phones = $order->o_shipping_phone;
$pushObj = new PushMessage($order->u_id);
$pushObj->pushMessage($str_push);
echo 'pushed to ' . $order->u_id . ' </br>';
$phoneObj = new Phone($order->o_shipping_phone);
$phoneObj->sendText($str_text);
echo 'texted to ' . $order->o_shipping_phone . ' </br>';
}
File::put('/var/www/qingnianchuangke/phones', implode(',', $phones));
$re = Tools::reTrue('发送中奖信息成功');
} catch (Exception $e) {
$re = Tools::reFalse($e->getCode(), '发送中奖信息失败:' . $e->getMessage());
}
return Response::json($re);
}
示例2: actionAdmin
public function actionAdmin()
{
$model = new Phone('search');
$model->unsetAttributes();
if (isset($_GET['Phone'])) {
$model->setAttributes($_GET['Phone']);
}
$this->render('admin', array('model' => $model));
}
示例3: xmlSerializeMustAppendFormattedPhoneData
/**
* @test
*/
public function xmlSerializeMustAppendFormattedPhoneData()
{
$this->markTestSkipped();
$xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><test />');
$phone = new Phone(479, 1234567890);
$phone->xmlSerialize($xml);
$this->assertEquals(47, (string) $xml->phone->areaCode);
$this->assertEquals(123456789, (string) $xml->phone->number);
}
示例4: createFromXML
/**
* Convert the raw XML into an object
*
* @param \SimpleXMLElement $xml
* @return Phone
*/
public static function createFromXML(\SimpleXMLElement $xml)
{
$phone = new Phone();
$attributes = $xml->attributes();
if (isset($attributes['type'])) {
$phone->setType((string) $attributes['type']);
}
$phone->setValue((string) $xml);
return $phone;
}
示例5: testPhone
public function testPhone()
{
$phone = new Phone('+00.000000000');
$this->assertEquals('+00.000000000', $phone->getPhone());
$phone = new Phone('+0.000000');
$this->assertEquals('+00.000000000', $phone->getPhone());
// test space stripping
$phone = new Phone('+00.0 0000 0000');
$this->assertEquals('+00.000000000', $phone->getPhone());
}
示例6: getVCode
/**
* generate and send a verification code
* @return response json output
*/
public function getVCode()
{
$mobile = Input::get('mobile');
try {
$phone = new Phone($mobile);
$code = $phone->sendVCode();
$data = ['vcode' => $code];
$re = ['data' => $data, 'result' => 2000, 'info' => '验证码已经发送'];
} catch (Exception $e) {
$re = ['data' => [], 'result' => 2001, 'info' => $e->getMessage()];
}
return Response::json($re);
}
示例7: data_parse
public function data_parse()
{
if (!empty($this->json_response['error'])) {
$this->error = $this->json_response['error']['message'];
} else {
$location_array = array();
while (list(, $results_val) = each($this->json_response['results'])) {
if (!empty($results_val)) {
// get phone data and people ids from belongs to
$phone = new Phone($this->json_response['dictionary'][$results_val]);
$this->phone = $phone->data();
$belongs_to = $phone->belongs_to;
$person_array = array();
$temp_location_array = array();
// get people data and store it in person_array
// store best location id of belongs to people in temp_location_array
if (!empty($belongs_to)) {
while (list(, $belongs_val) = each($belongs_to)) {
$person = new Person($this->json_response['dictionary'][$belongs_val]);
array_push($person_array, $person->data());
array_push($temp_location_array, $person->best_location());
}
$temp_location_array = array_filter($temp_location_array);
// get location data by location_keys array.
if (!empty($temp_location_array)) {
$location_keys = array_unique($temp_location_array);
while (list(, $location_key) = each($location_keys)) {
$location = new Location($this->json_response['dictionary'][$location_key]);
array_push($location_array, $location->data());
}
} else {
// get location data from phone best location id. if belongs to location id is blank.
if ($phone->best_location) {
$location = new Location($this->json_response['dictionary'][$phone->best_location]);
array_push($location_array, $location->data());
}
}
} else {
if ($phone->best_location) {
$location = new Location($this->json_response['dictionary'][$phone->best_location]);
array_push($location_array, $location->data());
}
}
$this->people = $person_array;
$this->location = $location_array;
}
}
}
}
示例8: GetInstance
/**
* @return Phone
*/
public static function GetInstance()
{
if (self::$Instance === null) {
self::$Instance = new Phone();
}
return self::$Instance;
}
示例9: delete
public function delete()
{
if (!Phone::delete($_POST['id'])) {
$_SESSION['ERROR'] = "Unable to delete phone number.";
}
// THIS IS STUPID
header("LOCATION: " . $_POST['path']);
}
示例10: handleCreate
public function handleCreate()
{
DB::transaction(function () {
$input = Input::all();
$person = new Person();
$localizationController = new LocalizationController();
$person->names = $input['names'];
$person->last_name = $input['last_name'];
$person->doc_number = $input['doc_number'];
$person->doc_type = $input['doc_type'];
$person->email = $input['email'];
$person->career = $input['career'];
$person->state = 1;
//para transformar a fecha
$borndate = date("Y-m-d", strtotime($input['born_date']));
$person->born_date = $borndate;
$person->nationality = $input['nationality'];
$person->academicdegree_id = $input['academicdegree_id'];
$person->localization_id = $localizationController->getLocalizationId($input['localization_dept'], $input['localization_prov'], $input['localization_dist']);
$person->save();
$i = 0;
foreach ($input['mobile_number'] as $mobil) {
$phone = new Phone();
$phone->person()->associate($person);
$phone->mobile_number = $mobil;
$phone->type = $input['phone_type'][$i];
$phone->save();
$i = $i + 1;
}
if (isset($input['notif1'])) {
//asociar la persona a las notificaciones de tipo 1
//$person->notifications()->save(Notification::find(1));
$person->notifications()->attach(1);
$person->notifications()->where('person_id', '=', $person->id)->update(array('state' => 1));
}
if (isset($input['notif2'])) {
//asociar la persona a las notificaciones de tipo 1
$person->notifications()->attach(2);
$person->notifications()->where('person_id', '=', $person->id)->update(array('state' => 1));
}
});
return Redirect::to('registro');
}
示例11: save
public function save(ProfilePage $page, $field, $value)
{
$deletePrivate = S::user()->isMe($page->owner) || S::admin();
Phone::deletePhones($page->pid(), Phone::LINK_ADDRESS, null, $deletePrivate);
Address::deleteAddresses($page->pid(), Address::LINK_PROFILE, null, null, $deletePrivate);
AddressReq::purge_requests($page->pid(), 0, 0, Address::LINK_PROFILE);
Address::saveFromArray($value, $page->pid(), Address::LINK_PROFILE, null, $deletePrivate);
if (S::user()->isMe($page->owner) && count($value) > 1) {
Platal::page()->trigWarning('Attention, tu as plusieurs adresses sur ton profil. Pense à supprimer celles qui sont obsolètes.');
}
}
示例12: add_phone_number
/**
* Добавляет юзеру номер телефона, принимая объект номера телефона,
* ассоциативный массив с кодом страны, кодом оператора и т.д. или
* строку с неформатированым номером телефона.
* Сохраняет телефонный номер в бд и возвращает его в случае успеха или
* false при неудаче
*/
public function add_phone_number($phone)
{
if (gettype($phone) === 'array') {
$phone = new Phone($phone);
} else {
if (gettype($phone) === 'string') {
$params = array();
$params['country_code'] = substr($phone, 0, 3);
$params['operator_code'] = substr($phone, 3, -7);
$params['phone_number'] = substr($phone, 5);
$phone = new Phone($params);
}
}
$phone->user_id = $this->id;
if ($phone->save()) {
$this->phones[] = $phone;
return $phone;
}
return false;
}
示例13: run
public function run()
{
$faker = Faker::create();
User::truncate();
Phone::truncate();
SMS::truncate();
User::create(['name' => 'John', 'email' => 'senhorbardell@gmail.com', 'password' => 'test', 'birthday' => $faker->date($format = 'Y-m-d', $max = 'now'), 'sex' => true, 'city' => $faker->numberBetween(0, 3)]);
foreach (range(1, 10) as $index) {
User::create(['name' => $faker->firstName, 'email' => $faker->email, 'birthday' => $faker->date($format = 'Y-m-d', $max = 'now'), 'city' => 2, 'sex' => $faker->boolean(), 'about' => $faker->paragraph($nbSentences = 3), 'password' => 'test']);
}
}
示例14: borrar_telefono
public function borrar_telefono()
{
$id = Input::get('idedit');
$telefono = Phone::find($id);
if ($telefono->delete()) {
Session::flash('message', 'Eliminado correctamente');
Session::flash('class', 'success');
} else {
Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente');
Session::flash('class', 'danger');
}
return Redirect::to('telefono');
}
示例15: checkType
private function checkType($value, $name, $type)
{
switch ($type) {
case 'email':
if (!fnmatch('*@*.*', $value)) {
$this->addError("'{$name}' must be a valid email address.");
}
break;
case 'phone':
if (!Phone::validNumber($value)) {
$this->addError("'{$name}' must be a valid phone number.");
}
break;
}
}