# yodphp - Yod Framework for PHP
It is a simple PHP framework which is written in C and build as PHP extension.
## Requirement
- PHP 5.2 +
## Homepage
- http://yodphp.com
## Tutorial
### installation
- Compiling Yod:
```
$PHP_BIN/phpize
./configure --with-php-config=$PHP_BIN/php-config
make
make install
```
- Compiling Yod with debug mode:
```
$PHP_BIN/phpize
./configure --enable-yod-debug --with-php-config=$PHP_BIN/php-config
make
make install
```
- Cross compiling Yod for i686-linux:
```
$PHP_BIN/phpize
./configure --enable-yod-debug --with-php-config=$PHP_BIN/php-config \
CCFLAGS="-m32" CPPFLAGS="-m32" CXXFLAGS="-m32" CFLAGS="-m32"
make
make install
```
### layout
- A classic Application directory layout:
```
+ code
+ Action // Other action
+ Config
- config.php // Configure
+ Home // Default module
+ Controller
- IndexController.php // Default controller
+ Model
- DemoModel.php
+ View
+ index // View templates for default controller
- index.php
+ Extend
+ Model
+ Plugin
+ Service
+ Widget
- index.php // Application entry
+ data
+ html
+ public
- index.php // Website entry (require './../code/index.php')
```
- Multiple entry Application directory layout:
```
- index.php // Application index entry
- hello.php // Application hello entry
+ public
+ webapp
```
### index.php
index.php is the application entry
```php
<?php
//set_time_limit(0);
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
defined('YOD_RUNPATH') or define('YOD_RUNPATH', dirname(__FILE__) . '/webapp');
```
### hello.php
hello.php is the application hello entry
```php
<?php
//set_time_limit(0);
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
defined('YOD_RUNPATH') or define('YOD_RUNPATH', dirname(__FILE__) . '/webapp');
class HelloController extends Yod_Controller
{
public function indexAction()
{
$this->assign('content', Yod::model('Hello')->content());
$this->display('/index/index');
}
public function errorAction()
{
echo '<pre>';
print_r($this);
}
}
class HelloModel extends Yod_Model
{
public function content()
{
return 'Hello World!';
}
}
```
### config.php
config.php is the application config file
```php
<?php
return array(
// db_dsn
'db_dsn' => array(
'type' => 'pdo',
'pdsn' => 'mysql:host=localhost;port=3306;dbname=test',
'host' => 'localhost',
'port' => '3306',
'user' => 'root',
'pass' => '123456',
'dbname' => 'test',
'prefix' => 'yod_',
'charset' => 'utf8',
// slaves
'slaves' => array(
array(
'dsn' => 'mysql:host=localhost;port=3306;dbname=test',
'user' => 'root',
'pass' => '123456',
),
),
),
// tpl_data
'tpl_data' => array(
'_PUBLIC_' => '/public/'
),
// url_rules (v1.3.1+)
'url_rules' => array(
'en/*' => '*',
'zh/*' => array('*', array('lang' => 'zh')),
'rule1' => 'index/rule1/p/v',
'index/rule1' => 'index/rule1/id/1',
'index/rule2/:id' => 'index/rule2',
'index/rule3/:id/edit' => 'index/rule3/action/edit',
'index/rule4/:id/remove' => array('index/rule4', array('action' => 'remove'),
),
);
```
### default controller
In Yodphp, the default controller is named IndexController
```php
<?php
class IndexController extends Yod_Controller {
// default action name
public function indexAction() {
$this->assign('content', 'Hello World');
$this->display();
}
}
```
###view script
The view script for default controller and default action is in the app/views/index/index.php
```php
<html>
<head>
<title>Hello World</title>
</head>
<body>
<?= $content; ?>
</body>
</html>
```
没有合适的资源?快使用搜索试试~ 我知道了~
PHP实例开发源码-Yod Framework PHP框架.zip
共87个文件
dll:24个
c:17个
h:17个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 97 浏览量
2022-11-21
21:44:00
上传
评论
收藏 1.38MB ZIP 举报
温馨提示
PHP实例开发源码—Yod Framework PHP框架.zip PHP实例开发源码—Yod Framework PHP框架.zip PHP实例开发源码—Yod Framework PHP框架.zip
资源推荐
资源详情
资源评论
收起资源包目录
PHP实例开发源码—Yod Framework PHP框架.zip (87个子文件)
132692270614518303
yodphp-1.4.0
dll
php_yod-1.4.0-5.4-vc9-x64-debug.dll 174KB
php_yod-1.4.0-5.3-vc9-x64.dll 166KB
php_yod-1.4.0-5.3-nts-vc9-x64-debug.dll 166KB
php_yod-1.4.0-5.4-nts-vc9-x64-debug.dll 166KB
php_yod-1.4.0-5.5-vc11-x86.dll 126KB
php_yod-1.4.0-5.4-vc9-x86.dll 130KB
php_yod-1.4.0-5.5-vc11-x64.dll 156KB
php_yod-1.4.0-5.4-vc9-x86-debug.dll 138KB
php_yod-1.4.0-5.5-nts-vc11-x64-debug.dll 157KB
php_yod-1.4.0-5.5-nts-vc11-x64.dll 148KB
php_yod-1.4.0-5.3-nts-vc9-x64.dll 157KB
php_yod-1.4.0-5.5-vc11-x86-debug.dll 134KB
php_yod-1.4.0-5.4-nts-vc9-x86-debug.dll 132KB
php_yod-1.4.0-5.5-vc11-x64-debug.dll 164KB
php_yod-1.4.0-5.4-vc9-x64.dll 166KB
php_yod-1.4.0-5.3-vc9-x64-debug.dll 174KB
php_yod-1.4.0-5.4-nts-vc9-x86.dll 125KB
php_yod-1.4.0-5.4-nts-vc9-x64.dll 158KB
php_yod-1.4.0-5.3-nts-vc9-x86-debug.dll 132KB
php_yod-1.4.0-5.3-vc9-x86-debug.dll 137KB
php_yod-1.4.0-5.5-nts-vc11-x86.dll 123KB
php_yod-1.4.0-5.5-nts-vc11-x86-debug.dll 130KB
php_yod-1.4.0-5.3-nts-vc9-x86.dll 123KB
php_yod-1.4.0-5.3-vc9-x86.dll 129KB
src
Driver
DbMysqli.php 8KB
DbMysql.php 7KB
errlog.php 15KB
yod
yod_plugin.h 1KB
yod_request.c 31KB
yod_plugin.c 2KB
php_yod.h 6KB
yod_widget.c 6KB
yod_controller.h 1KB
yod.dsp 9KB
yod_action.h 1KB
yod_application.h 1KB
yod_database.h 2KB
yod_dbmodel.c 50KB
tools
screw_enc 474B
screw_encrypt.c 3KB
Makefile 240B
yod_action.c 2KB
yod_server.h 1KB
yod_base.h 1KB
tests
014.phpt 3KB
008.phpt 3KB
002.phpt 1KB
013.phpt 3KB
006.phpt 1KB
004.phpt 2KB
009.phpt 576B
005.phpt 2KB
999.phpt 191B
010.phpt 2KB
012.phpt 2KB
007.phpt 3KB
clean.php 1KB
001.phpt 531B
011.phpt 1KB
003.phpt 2KB
yod_model.c 27KB
yod_dbpdo.c 32KB
yod_debug.c 7KB
crypt
screw.c 4KB
screw.h 673B
LICENSE 1KB
screw_key.h 73B
yod_controller.c 29KB
yod_database.c 40KB
yod_debug.h 2KB
yod_application.c 5KB
yod_dbmodel.h 1KB
config.w32 1KB
yod_widget.h 1KB
yodphp.php 61KB
yod_server.c 13KB
yod_dbpdo.h 1KB
yod.c 27KB
yod_request.h 2KB
yod_base.c 22KB
config.m4 2KB
yod_model.h 1KB
yod_client.c 25KB
yod_client.h 1KB
Changelog 6KB
README.md 4KB
使用须知.txt 0B
共 87 条
- 1
资源评论
毕业_设计
- 粉丝: 1924
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功