lamp9 2017-07-13 10:07:42 7001次浏览 0条回复 0 0 0

建表语句:

CREATE TABLE article (
id int(11) NOT NULL AUTO_INCREMENT,
sort_id int(11) NOT NULL DEFAULT '0',
top int(11) NOT NULL DEFAULT '0' COMMENT '推荐',
title char(255) CHARACTER SET latin1 NOT NULL,
time int(11) NOT NULL DEFAULT '0',
content text CHARACTER SET latin1 NOT NULL,
tag varchar(500) NOT NULL DEFAULT '',
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;

错误信息:

Exception (Database Exception) 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE5\x89\x8D\xE7\xAB\xAF...' for column 'content' at row 1
The SQL being executed was: INSERT INTO `article` (`sort_id`, `title`, `time`, `top`, `content`, `tag`) VALUES (1, 'tttt', 1499937403, 3, '<p>前端 – React 路由</p><p>React Router 课程介绍</p><p>安装 React Router</p><p>&nbsp; &nbsp; jspm install react-router@1.0.0.rcl</p><p>&nbsp; &nbsp; ————————</p><p>&nbsp; &nbsp; import { Router, Route, Link } from ‘react-router’;</p><p>&nbsp; &nbsp; ————————</p><p>准备 React 组件</p><p>&nbsp; &nbsp; —————————</p><p>&nbsp; &nbsp; ‘use strict’;</p><p>&nbsp; &nbsp; import ‘semantic-ui/semantic.min.css!’;</p><p>&nbsp; &nbsp; import React from ‘react’;</p><p>&nbsp; &nbsp; import ReactDOM from ‘react-dom’;</p><p>&nbsp; &nbsp; import { Router, Route, Link } from ‘react-router’;</p><p>&nbsp; &nbsp; class App extends React.Component {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui secondary pointing menu”&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { /* links*/}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class TV extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui info message”&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TV LIST</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class Show extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;节目&lt;/h3&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; —————————</p><p>定义路由</p><p>&nbsp; &nbsp; ————————–</p><p>&nbsp; &nbsp; ………..</p><p>&nbsp; &nbsp; class App extends React.Component {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui secondary pointing menu”&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/” className=”item”&gt;index&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/tv” className=”item”&gt;TV&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ………….</p><p>&nbsp; &nbsp; ReactDOM.render((</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;Router&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/” component={App}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”tv” component={TV}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”shows/:id” component={Show}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Router&gt;</p><p>&nbsp; &nbsp; ), document.getElementById(‘app’));</p><p>&nbsp; &nbsp; ————————–</p><p>得到地址里的参数</p><p>&nbsp; &nbsp; ————————</p><p>&nbsp; &nbsp; ………….</p><p>&nbsp; &nbsp; class Show extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; constructor(props){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(props);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(this.props.params);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;节目 {this.props.params.id}&lt;/h3&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; …………..</p><p>&nbsp; &nbsp; ————————</p><p>索引 – IndexRoute</p><p>&nbsp; &nbsp; ——————–</p><p>&nbsp; &nbsp; ‘use strict’;</p><p>&nbsp; &nbsp; import ‘semantic-ui/semantic.min.css!’;</p><p>&nbsp; &nbsp; import React from ‘react’;</p><p>&nbsp; &nbsp; import ReactDOM from ‘react-dom’;</p><p>&nbsp; &nbsp; import { Router, Route, Link, IndexRoute } from ‘react-router’;</p><p>&nbsp; &nbsp; class App extends React.Component {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui secondary pointing menu”&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/” className=”item”&gt;index&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/tv” className=”item”&gt;TV&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class TV extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class Show extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; constructor(props){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(props);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(this.props.params);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;节目 {this.props.params.id}&lt;/h3&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class Home extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui info message”&gt;Index Content&lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class ShowIndex extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui info message”&gt;TV LIST&lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; };</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ReactDOM.render((</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;Router&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/” component={App}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={Home}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”tv” component={TV}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={ShowIndex}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”shows/:id” component={Show}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Router&gt;</p><p>&nbsp; &nbsp; ), document.getElementById(‘app’));</p><p>&nbsp; &nbsp; ——————–</p><p>&nbsp; &nbsp; http://localhost/</p><p>&nbsp; &nbsp; http://localhost/#/tv</p><p>&nbsp; &nbsp; http://localhost/#/tv/shows/1</p><p>路由里的绝对路径与重定向</p><p>&nbsp; &nbsp; ———————–</p><p>&nbsp; &nbsp; import { Router, Route, Link, IndexRoute, Redirect } from ‘react-router’;</p><p>&nbsp; &nbsp; ………………</p><p>&nbsp; &nbsp; ReactDOM.render((</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;Router&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/” component={App}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={Home}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”tv” component={TV}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={ShowIndex}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/shows/:id” component={Show}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Redirect from=”show/:id” to=”/show/:id”/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Router&gt;</p><p>&nbsp; &nbsp; ), document.getElementById(‘app’));</p><p>&nbsp; &nbsp; ———————–</p><p>&nbsp; &nbsp; http://localhost/#/shows/1</p><p>&nbsp; &nbsp; http://localhost/#/tv/shows/1</p><p>进入与离开 – onEnter,&nbsp; onLeave</p><p>&nbsp; &nbsp; ———————–</p><p>&nbsp; &nbsp; ………………</p><p>&nbsp; &nbsp; function handleEnter(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; console.log(‘Enter’);</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; function handleLeave(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; console.log(‘Leave’);</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ReactDOM.render((</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;Router&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/” component={App}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={Home}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”tv” component={TV}&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;IndexRoute component={ShowIndex}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Route path=”/shows/:id” component={Show}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;onEnter={handleEnter}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;onLeave={handleLeave}/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Redirect from=”show/:id” to=”/show/:id”/&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/Route&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Router&gt;</p><p>&nbsp; &nbsp; ), document.getElementById(‘app’));</p><p>&nbsp; &nbsp; ———————–</p><p>查询符 – query</p><p>&nbsp; &nbsp; ———————-</p><p>&nbsp; &nbsp; …………….</p><p>&nbsp; &nbsp; class TV extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; constructor(props){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(props);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let {query} = this.props.location;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(this.props);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(query);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ……………</p><p>&nbsp; &nbsp; class App extends React.Component {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; render(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div className=”ui secondary pointing menu”&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/” className=”item”&gt;index&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Link to=”/tv” className=”item” query={{orderBy: ‘date’}}&gt;TV&lt;/Link&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {this.props.children}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ……………</p><p>&nbsp; &nbsp; ———————-</p><p>组件的生命周期与路由</p><p>&nbsp; &nbsp; ————————</p><p>&nbsp; &nbsp; class App extends React.Component {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; componentDidMount(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘App did mount’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; componentWillReceiveProps(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘App will receive props’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; componentDidUpdate(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘App did update’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; …………..</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class Home extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; componentDidMount(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘Home did mount’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; componentWillUnmount(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘Home will unmount’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; ………..</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; class TV extends React.Component{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; ………..</p><p>&nbsp; &nbsp; &nbsp; &nbsp; compontDidMount(){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(‘TV did mount’);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; ………..</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; ————————</p><p>&nbsp; &nbsp; Home did mount</p><p>&nbsp; &nbsp; App did mount</p><p>&nbsp; &nbsp; App will receive props</p><p>&nbsp; &nbsp; Home will unmount</p><p>&nbsp; &nbsp; Object…..</p><p>&nbsp; &nbsp; TV div mount</p><p>&nbsp; &nbsp; App did update</p><p><br/></p>', '')' 

in E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\Schema.php:636

Stack trace:
#0 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\Command.php(856): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `ar...')
#1 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\Schema.php(454): yii\db\Command->execute()
#2 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\ActiveRecord.php(494): yii\db\Schema->insert('article', Array)
#3 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\ActiveRecord.php(461): yii\db\ActiveRecord->insertInternal(NULL)
#4 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\db\BaseActiveRecord.php(635): yii\db\ActiveRecord->insert(false, NULL)
#5 E:\www\phpfetcherTest\widget\AdminListConfig.php(63): yii\db\BaseActiveRecord->save(false)
#6 E:\www\phpfetcherTest\logic\BaseController.php(66): app\widget\AdminListConfig::showCreate(Object(app\controllers\ArticleController), false, false, false, true)
#7 [internal function]: app\logic\BaseController->actionCreate()
#8 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#9 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\base\Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#10 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\base\Module.php(523): yii\base\Controller->runAction('create', Array)
#11 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\web\Application.php(102): yii\base\Module->runAction('article/create', Array)
#12 E:\FrameWork\yii2\advanced\vendor\yiisoft\yii2\base\Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#13 E:\www\phpfetcherTest\web\index.php(19): yii\base\Application->run()
#14 {main}
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册