本文整理汇总了PHP中Input::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::put方法的具体用法?PHP Input::put怎么用?PHP Input::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put_index
public function put_index($id)
{
$put = json_decode(Input::put()['model'], true);
$data = array('title' => $put['title'], 'domain' => $put['domain'], 'user' => $put['user'], 'pass' => $put['pass'], 'updated_at' => time());
try {
DB::update(Model_Site::table())->set($data)->where('id', '=', $id)->execute();
return $this->response(array('ok' => true));
} catch (Exception $e) {
return $this->response(array('ok' => false, 'message' => $e->getMessage()), 500);
}
}
示例2: put_index
public function put_index($siteId)
{
$put = json_decode(Input::put()['model'], true);
if ($this->isExist($siteId)) {
try {
DB::transaction_start();
DB::commit();
} catch (Exception $e) {
DB::rollback();
}
} else {
}
}
示例3: put_index
/**
* Updates a seller callback.
*
* @param int $seller_id Seller ID.
* @param int $id Seller callback ID.
*
* @return void
*/
public function put_index($seller_id = null, $id = null)
{
$callback = $this->get_callback($id);
$validator = \Validation_Seller_Callback::update();
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$callback = \Service_Seller_Callback::update($callback, $data);
if (!$callback) {
throw new HttpServerErrorException();
}
$this->response($callback);
}
示例4: put_index
/**
* Updates a seller contact.
*
* @param int $seller_id Seller ID.
* @param int $id Contact ID.
*
* @return void
*/
public function put_index($seller_id = null, $id = null)
{
$contact = $this->get_contact($id);
$validator = \Validation_Contact::update('seller');
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$contact = \Service_Contact::update($contact, $data);
if (!$contact) {
throw new HttpServerErrorException();
}
$this->response($contact);
}
示例5: put_index
/**
* Updates a gateway.
*
* @param int $seller_id Seller ID.
* @param int $id Gateway ID.
*
* @return void
*/
public function put_index($seller_id = null, $id = null)
{
$gateway = $this->get_gateway($id);
$validator = \Validation_Gateway::update();
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$gateway = \Service_Gateway::update($gateway, $data);
if (!$gateway) {
throw new HttpServerErrorException();
}
$this->response($gateway);
}
示例6: put_index
/**
* Updates a customer.
*
* @param int $id Customer ID.
*
* @return void
*/
public function put_index($id = null)
{
$customer = $this->get_customer($id);
$validator = \Validation_Customer::update();
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$customer = \Service_Customer::update($customer, $data);
if (!$customer) {
throw new HttpServerErrorException();
}
$this->response($customer);
}
示例7: put_index
/**
* Updates a payment method.
*
* @param int $customer_id Customer ID.
* @param int $id Payment method ID.
*
* @return void
*/
public function put_index($customer_id = null, $id = null)
{
$customer = $this->get_customer($customer_id);
$payment_method = $this->get_paymentmethod($id, $customer);
$validator = \Validation_Customer_Paymentmethod::update($payment_method->gateway);
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$payment_method = \Service_Customer_Paymentmethod::update($payment_method, $data);
if (!$payment_method) {
throw new HttpServerErrorException();
}
$this->response($payment_method);
}
示例8: put_index
/**
* Updates a product option.
*
* @param int $product_id Product ID.
* @param int $id Product option ID.
*
* @return void
*/
public function put_index($product_id = null, $id = null)
{
$product = $this->get_product($product_id);
$option = $this->get_option($id, $product);
$validator = \Validation_Product_Option::update();
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$option = \Service_Product_Option::update($option, $data);
if (!$option) {
throw new HttpServerErrorException();
}
$this->response($option);
}
示例9: PUT_infoAction
/**
* 修改信息
* @param [type] $id [description]
* @todo 价格
*/
public function PUT_infoAction($id)
{
$this->authPrinter($id);
$info = [];
/*店名*/
Input::put('name', $var, 'title') and $info['name'] = $var;
/*邮箱*/
Input::put('email', $var, 'email') and $info['email'] = $var;
/*手机*/
Input::put('phone', $var, 'phone') and $info['phone'] = $var;
/*qq号*/
Input::put('qq', $var, 'int') and $info['qq'] = $var;
/*微信号*/
Input::put('wechat', $var, 'char_num') and $info['wechat'] = $var;
/*地址*/
Input::put('address', $var, 'text') and $info['address'] = $var;
/*简介*/
Input::put('profile', $var, 'text') and $info['profile'] = $var;
/*营业时间*/
Input::put('open', $var, 'text') and $info['open'] = $var;
/*营业时间*/
Input::put('other', $var, 'text') and $info['other'] = $var;
/*价格*/
$price = [];
Input::put('price_s', $price['s'], 'float');
Input::put('price_d', $price['d'], 'float');
Input::put('price_c_s', $price['c_s'], 'float');
Input::put('price_c_d', $price['c_d'], 'float');
if (!empty(array_filter($price))) {
if ($oldprice = PrinterModel::where('id', $id)->get('price')) {
if ($oldprice = @json_decode($oldprice, true)) {
$price = array_merge($oldprice, array_filter($price));
}
}
$info['price'] = json_encode($price);
}
if (empty($info)) {
$this->response(0, '无有效参数');
} elseif (PrinterModel::where('id', $id)->update($info) !== false) {
$this->response(1, $info);
} else {
$this->response(0, '修改失败');
}
}
示例10: PUT_infoAction
/**
* 修改状态
* @param [type] $id [description]
*/
public function PUT_infoAction($id)
{
$pid = $this->authPrinter();
$response['status'] = 0;
if (!Input::put('status', $status, 'int')) {
$response['info'] = '无效状态';
} elseif ($status < -1 || $status > 5) {
$response['info'] = '此状态不允许设置';
} elseif ($status == -1 && TaskModel::where('id', intval($id))->where('pri_id', $pri_id)->get('payed')) {
//取消订单
$response['info'] = '已支付暂不支持线上取消';
} elseif (TaskModel::where('id', intval($id))->where('pri_id', $pid)->update(['status' => $status])) {
$response['status'] = 1;
$response['info'] = '修改成功';
} else {
$response['info'] = '状态设置失败';
}
$this->response = $response;
}
示例11: put_index
/**
* Updates a seller.
*
* @param int $id Seller ID.
*
* @return void
*/
public function put_index($id = null)
{
if (!$id) {
throw new HttpNotFoundException();
}
$seller = \Service_Seller::find_one($id);
if (!$seller || $seller != \Seller::active()) {
throw new HttpNotFoundException();
}
$validator = \Validation_Seller::update();
if (!$validator->run(\Input::put())) {
throw new HttpBadRequestException($validator->errors());
}
$data = $validator->validated();
$seller = \Service_Seller::update($seller, $data);
if (!$seller) {
throw new HttpServerErrorException();
}
$this->response($seller);
}
示例12: action_index
/**
* This is a test page to test basic curl requests and responses.
* @return mixed
*/
public function action_index()
{
try {
//init data response
$data = array();
//get url
$data['url'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
//get method
$data['method'] = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
//get params
$data['params']['get'] = \Input::get();
$data['params']['post'] = \Input::post();
$data['params']['put'] = \Input::put();
$data['params']['delete'] = \Input::delete();
//return response
$this->response(array('data' => $data));
} catch (\Exception $e) {
//return caught exceptions to json response
$this->response(array('exception' => $e->getMessage()));
}
}
示例13: PUT_indexAction
/**
* 重置密码
* @method POST_printerAction
* @author NewFuture
*/
public function PUT_indexAction($id)
{
$this->auth($id);
$response['status'] = 0;
if (!Input::put('password', $password, 'isMd5')) {
$response['info'] = '新的密码格式不对';
} elseif (!Input::put('old', $old_pwd, 'isMd5')) {
$response['info'] = '请输入原密码';
} else {
/*数据库中读取用户数据*/
$printer = PrinterModel::field('password,account')->find($id);
$account = $printer['account'];
if (!$printer || Encrypt::encryptPwd($old_pwd, $account) != $printer['password']) {
$response['info'] = '原密码错误';
} elseif ($printer->update(['password' => Encrypt::encryptPwd($password, $account)]) >= 0) {
$response['info'] = '修改成功';
$response['status'] = 1;
} else {
$response['info'] = '修改失败';
}
}
$this->response = $response;
}
示例14: PUT_emailAction
/**
* 修改用户邮箱
* PUT /user/1/phone {code:"C09Eaf"}
* @method GET_infoAction
* @param integer $id [description]
* @author NewFuture
*/
public function PUT_emailAction($id = 0)
{
$id = $this->auth($id);
$response['status'] = 0;
$Code = new Model('code');
if (!Input::put('code', $code, 'ctype_alnum')) {
$response['info'] = '验证码格式不对';
} elseif (!$Code->where('use_id', $id)->where('type', 1)->field('id,time,code,content')->find()) {
$response['info'] = '验证信息不存在';
} elseif (!Safe::checkTry('email_code_' . $id)) {
$Code->delete();
Safe::del('email_code_' . $id);
$response['info'] = '尝试次数过多,请重新验证';
} elseif (strtoupper($code) != strtoupper(substr($Code['code'], -6))) {
$response['info'] = '验证码不匹配';
} elseif (!UserModel::saveEmail($Code['content'], $Code['use_id'])) {
$response['info'] = '邮箱绑定失败';
} else {
$Code->delete();
Safe::del('email_code_' . $id);
$response['info'] = $Code['content'];
$response['status'] = 1;
}
$this->response = $response;
}
示例15: PUT_infoAction
/**
* 获取详情
* PUT /books/123
* @method GET_infoAction
* @param integer $id [资源id]
* @author NewFuture
*/
public function PUT_infoAction($id = 0)
{
$pid = $this->authPrinter();
$book = [];
if (Input::put('name', $name, 'title')) {
$book['name'] = $name;
}
if (Input::put('detail', $detail, 'text')) {
$book['detail'] = $detail;
}
if (Input::put('price', $price, 'float')) {
$book['price'] = $price;
}
if (empty($book)) {
$this->response(0, '无修改内容');
} elseif (BookModel::where('id', $id)->where('pri_id', $pid)->update($book)) {
$this->response(1, $book);
} else {
$this->response(0, '修改失败');
}
}