本文整理汇总了PHP中FileUtil::write方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::write方法的具体用法?PHP FileUtil::write怎么用?PHP FileUtil::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
protected function write($path, $content)
{
return FileUtil::write($path, $content);
}
示例2: upload
function upload()
{
if ($this->isPost() && $this->isFile('stage')) {
$file = $this->getFile('stage');
$src = mb_convert_encoding(file_get_contents($file->tmp), 'utf-8', 'Shift_JIS,EUC-JP,UTF-8');
if (SimpleTag::setof($tag, $src, 'body', true)) {
foreach ($tag->getIn('applet') as $applet) {
if ($applet->getParameter('code') != 'MasaoConstruction') {
continue;
}
$gamedata = array();
foreach ($applet->getIn('param') as $param) {
$gamedata[$param->getParameter('name')] = array('name' => $param->getParameter('name'), 'value' => $param->getParameter('value'));
}
if (empty($gamedata)) {
break;
}
$stage = $this->dbUtil->insert($this->toObject(new Stage()));
if (!Variable::istype('Stage', $stage)) {
break;
}
$_images = array('title', 'ending', 'gameover', 'pattern', 'chizu');
foreach ($_images as $k) {
if (!isset($gamedata[sprintf("filename_%s", $k)])) {
continue;
}
$gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => 'images/' . $k . '.gif');
if ($this->isFile('img_' . $k)) {
$image = $this->getFile('img_' . $k);
$img_info = getimagesize($image->tmp);
if ($img_info[2] != IMAGETYPE_GIF) {
continue;
}
$filename = Rhaco::path(sprintf('images/%s_%d.gif', $k, $stage->id));
if (move_uploaded_file($image->tmp, $filename)) {
$gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => sprintf("images/%s_%d.gif", $k, $stage->getId()));
}
}
}
FileUtil::write(Rhaco::path(sprintf('stages/%d.apif', $stage->id)), serialize($gamedata));
Header::redirect(Rhaco::url());
Rhaco::end();
}
}
}
return $this->parser('upload.html');
}