當前位置: 首頁>>代碼示例>>PHP>>正文


PHP stdClass::save方法代碼示例

本文整理匯總了PHP中stdClass::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP stdClass::save方法的具體用法?PHP stdClass::save怎麽用?PHP stdClass::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stdClass的用法示例。


在下文中一共展示了stdClass::save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: trainOnFile

 /**
  * Train On File.
  * 
  * @return bool
  */
 public function trainOnFile()
 {
     $maxEpochs = 500000;
     $epochsBetweenReports = 1000;
     $desiredError = 0.001;
     $result = $this->neuralNetwork->trainOnFile($maxEpochs, $epochsBetweenReports, $desiredError);
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to train neural network on file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     $result = $this->neuralNetwork->save();
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to save neural network to file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     return $result;
 }
開發者ID:ericmdev,項目名稱:NoughtsAndCrosses,代碼行數:20,代碼來源:Player.php

示例2: moveFile

 /**
  * Move file from the temporary destination to the original destination
  *
  * @param \stdClass $file
  * @throws File\Exception
  */
 public static final function moveFile($file)
 {
     try {
         if ($file->is_temp) {
             rename($file->temp_destination . '/' . $file->temp_name, $file->original_destination . '/' . $file->temp_name);
             if (!file_exists($file->original_destination . '/' . $file->temp_name)) {
                 throw new CannotSaveFileInHardDriveException();
             }
             $file->is_temp = false;
             $file->expire = null;
             $file->save();
         }
     } catch (\Exception $exception) {
         throw new FileException($exception->getMessage());
     }
 }
開發者ID:vegas-cmf,項目名稱:media,代碼行數:22,代碼來源:Helper.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $shipment = new \stdClass();
     $shipment->order_id = $form_state->getValue('order_id');
     if ($form_state->hasValue('sid')) {
         $shipment->sid = $form_state->getValue('sid');
     }
     $shipment->origin = (object) $form_state->getValue('pickup_address');
     $shipment->destination = new \stdClass();
     foreach ($form_state->getValues() as $key => $value) {
         if (substr($key, 0, 9) == 'delivery_') {
             $field = substr($key, 9);
             $shipment->destination->{$field} = $value;
         }
     }
     $shipment->packages = array();
     foreach ($form_state->getValue('packages') as $id => $pkg_form) {
         $package = Package::load($id);
         $package->pkg_type = $pkg_form['pkg_type'];
         $package->value = $pkg_form['declared_value'];
         $package->length = $pkg_form['dimensions']['length'];
         $package->width = $pkg_form['dimensions']['width'];
         $package->height = $pkg_form['dimensions']['height'];
         $package->length_units = $pkg_form['dimensions']['units'];
         $package->tracking_number = $pkg_form['tracking_number'];
         $package->qty = 1;
         $shipment->packages[$id] = $package;
     }
     $shipment->shipping_method = $form_state->getValue('shipping_method');
     $shipment->accessorials = $form_state->getValue('accessorials');
     $shipment->carrier = $form_state->getValue('carrier');
     $shipment->transaction_id = $form_state->getValue('transaction_id');
     $shipment->tracking_number = $form_state->getValue('tracking_number');
     $shipment->ship_date = $form_state->getValue('ship_date')->getTimestamp();
     $shipment->expected_delivery = $form_state->getValue('expected_delivery')->getTimestamp();
     $shipment->cost = $form_state->getValue('cost');
     $shipment->save();
     $form_state->setRedirect('uc_fulfillment.shipments', ['uc_order' => $form_state->getValue('order_id')]);
 }
開發者ID:justincletus,項目名稱:webdrupalpro,代碼行數:42,代碼來源:ShipmentEditForm.php


注:本文中的stdClass::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。