icebox-php/icebox
最新稳定版本:v0.1.2
Composer 安装命令:
composer create-project icebox-php/icebox
包简介
The skeleton application for the Icebox Framework.
关键字:
README 文档
README
composer create-project icebox-php/icebox my-app
cd my-app
How to run this web-app
cd my-app
composer install
php icebox server
It will run the application to this url http://localhost:8800
If you want to run in different host and port
php icebox server --host=0.0.0.0 --port=8802
It will run the application to this url http://0.0.0.0:8802
Home: http://localhost/my-app/index.php
Page 2: http://localhost/my-app/index.php/leap_year/2012
or : http://localhost/my-app/leap_year/2012
Example urls to test params
http://localhost/my-app/about/marketing/item/5/title/some-text
404 error page
http://localhost/my-app/an-invalid-url
How to run testsuite
vendor/bin/phpunit ./Test/
How to upload image
-
create a string column, Such as, I added "picture" column, datatype: varchar, length: 255
-
Add this code to _form:
<div class="form-group">
<label for="post_picture">Picture</label>
<input id="post_picture" type="file" name="picture">
</div>
- In controller, after you save model, a. upload file and b. set file name in model and c. save the model again with validate false.
Add this code to controller (I added this code in "create" action):
if($saved) {
if(isset($_FILES['picture'])) {
$pictue_file_name = md5(microtime()) . '.jpg';
$path = 'public/images/' . $pictue_file_name;
move_uploaded_file($_FILES['picture']['tmp_name'], $path);
$post->picture = $pictue_file_name;
$post->save(false);
}
....
....
} else {
....
....
}
- now you can show this image in "View/Posts/show.html.php" view:
<img src="<?php echo App::root_url(); ?>/images/<?php echo $post->picture; ?>" alt="">
Configuration
You can dynamically configure your application using App::configure() and retrieve values with App::config().
// Usage Config::set([ 'log_level' => 'info', 'time_zone' => 'UTC', 'nested' => [ 'option' => 'some-value', ] ]); // Later, override specific values Config::set([ 'log_level' => 'debug', // This overrides the previous value ]); echo Config::get('log_level'); // 'debug' echo Config::get('time_zone'); // 'UTC' echo Config::get('nested.option'); // 'some-value'
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-11