本文整理匯總了PHP中Inventory::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inventory::clear方法的具體用法?PHP Inventory::clear怎麽用?PHP Inventory::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inventory
的用法示例。
在下文中一共展示了Inventory::clear方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: switch
function _parse($file, $template = 1)
{
switch ($template) {
case 1:
$serial_number = 0;
$type = 1;
$code = 2;
$number = 3;
$description = 4;
break;
}
$this->load->library("cvsreader");
$filedata = $this->csvreader->parse_file($file["full_path"]);
$inventoryObject = new Inventory();
$rownumber = 0;
foreach ($filedata as $row) {
foreach ($row as $csvstring) {
$elements = array_fill(0, 5, "");
$elements = $this->csvreader->get_csv_values($csvstring);
if (strlen(trim($elements[$code])) > 0) {
$rownumber = $rownumber + 1;
// Just a quick check on the number of rows being added
$inventoryObject->vendor_id = $elements[$vendor_id];
$inventoryObject->type = ucwords(strtolower(trim($elements[$type])));
$inventoryObject->code = strtoupper(trim($elements[$code]));
$inventoryObject->sale_price = $elements[$number] + 100;
$inventoryObject->cost_price = 0.45 * $inventoryObject->sale_price;
$inventoryObject->description = $elements[$description];
$inventoryObject->status = 1;
$inventoryObject->save();
}
$inventoryObject->clear();
}
}
}