{"action":"created","issue":{"url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/1","labels_url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/1/comments","events_url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/1/events","html_url":"https://github.com/yaoshiyizhu/mySudy/issues/1","id":102170540,"number":1,"title":"sdfs","user":{"login":"yaoshiyizhu","id":3760157,"avatar_url":"https://avatars.githubusercontent.com/u/3760157?v=3","gravatar_id":"","url":"https://api.github.com/users/yaoshiyizhu","html_url":"https://github.com/yaoshiyizhu","followers_url":"https://api.github.com/users/yaoshiyizhu/followers","following_url":"https://api.github.com/users/yaoshiyizhu/following{/other_user}","gists_url":"https://api.github.com/users/yaoshiyizhu/gists{/gist_id}","starred_url":"https://api.github.com/users/yaoshiyizhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaoshiyizhu/subscriptions","organizations_url":"https://api.github.com/users/yaoshiyizhu/orgs","repos_url":"https://api.github.com/users/yaoshiyizhu/repos","events_url":"https://api.github.com/users/yaoshiyizhu/events{/privacy}","received_events_url":"https://api.github.com/users/yaoshiyizhu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T15:49:40Z","updated_at":"2015-08-21T06:38:19Z","closed_at":null,"body":"sdfsdfs"},"comment":{"url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/comments/133305559","html_url":"https://github.com/yaoshiyizhu/mySudy/issues/1#issuecomment-133305559","issue_url":"https://api.github.com/repos/yaoshiyizhu/mySudy/issues/1","id":133305559,"user":{"login":"yaoshiyizhu","id":3760157,"avatar_url":"https://avatars.githubusercontent.com/u/3760157?v=3","gravatar_id":"","url":"https://api.github.com/users/yaoshiyizhu","html_url":"https://github.com/yaoshiyizhu","followers_url":"https://api.github.com/users/yaoshiyizhu/followers","following_url":"https://api.github.com/users/yaoshiyizhu/following{/other_user}","gists_url":"https://api.github.com/users/yaoshiyizhu/gists{/gist_id}","starred_url":"https://api.github.com/users/yaoshiyizhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaoshiyizhu/subscriptions","organizations_url":"https://api.github.com/users/yaoshiyizhu/orgs","repos_url":"https://api.github.com/users/yaoshiyizhu/repos","events_url":"https://api.github.com/users/yaoshiyizhu/events{/privacy}","received_events_url":"https://api.github.com/users/yaoshiyizhu/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T06:38:19Z","updated_at":"2015-08-21T06:38:19Z","body":"单元格内换行<br style='mso-data-placement:same-cell;'/>\r\n强制以字符显示 style=\"vnd.ms-excel.numberformat:@\"\r\n border-collapse:collapse; table合并边框\r\n\r\nhttp://www.manning.com/bibeault/\r\nhttp://121.15.134.94:9898/KDHRMS/Default.aspx\r\n{@ if is_array($order)&& count($order)!=0@} smarty判断是否是数组\r\n\t\t\theader( \"Pragma: public\" );\r\n\t\t\theader( \"Expires: 0\" );\r\n\t\t\theader(\"Accept-Ranges: bytes\");\r\n\t\t\theader(\"Content-Disposition: attachment; filename={$interfaceType}.csv\");\r\n\t\t\theader(\"Content-Type:APPLICATION/OCTET-STREAM;charset=gb2312\");\r\n\r\n    ob_clean();\r\n     ob_flush();//清空输出内容\r\nborder-collapse:collapse;合并边框粗洗\r\n.print_pdfcff{\r\n    -webkit-transform: rotate(90deg);\r\n    -moz-transform: rotate(90deg); \r\n    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);} 旋转样式\r\narray_product\r\nALTER TABLE orders CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;\r\n------------------------------------------------------------------------------------------------------------------------\r\n\r\n--------------------------------------------------\r\n phpexcel单元格内换行\r\n------------------------------------------------------------------------------------------------------------------------\r\n\r\n--------------------------------------------------\r\n我说的这个换行不是字多了，自动换行的那种，是在特定位置添加换行符\r\n\r\n代码如下：\r\n$objPHPExcel->setActiveSheetIndex(0)\r\n            ->setCellValue('A4', “Hello\\nWorld”)；\r\n\r\n 然后注意两点\r\n\r\n一是要有下面的代码配合\r\n$objPHPExcel->getActiveSheet()->getStyle('A4')->getAlignment()->setWrapText(true);\r\n\r\n 二是要换行的字符串Hello\\nWorld外面必须是双引号\r\n//设置excel以字符串形式显示\r\n$activeSheet->setCellValueExplicit(\"D\".$i,$row['lz_zip'],PHPExcel_Cell_DataType::TYPE_STRING);\r\n$activeSheet->getStyle('D'.$i)->getNumberFormat()->setFormatCode(\"@\");\r\n------------------------------------------------------------------------------------------------------------------------\r\n\r\n------------------------------------------------------------\r\npcntl_fork\r\n-------------------------------------------------------------------------------------------------\r\n-webkit-text-size-adjust:none; \r\n------------------------------------------------------------------------------------------------\r\n下载解决带空格乱码问题，\r\n$fileName=urlencode($fileName);\r\n            $filename=str_replace('+','%20',$fileName);\r\n            $explerType=$_SERVER['HTTP_USER_AGENT'];\r\n            if(preg_match(\"/MSIE/\", $explerType)) {\r\n                $headerStr='Content-Disposition: attachment; filename=\"' . $filename . '\"';\r\n            } else if (preg_match(\"/Firefox/\", $explerType)) {\r\n                $headerStr='Content-Disposition: attachment; filename*=\"utf8\\'\\'' . $filename . '\"';\r\n            } else {\r\n               $headerStr='Content-Disposition: attachment; filename=\"' . $filename . '\"';\r\n            }\r\n            header( \"Pragma: public\" );\r\n            header( \"Expires: 0\" );\r\n            header(\"Accept-Ranges: bytes\");\r\n            header($headerStr);\r\n            header(\"Content-Type:APPLICATION/OCTET-STREAM;charset=gb2312\");\r\n\r\n-------------------------------------------------\r\nmysql 中文排序\r\nselect name from test1 order by convert(name using gb2312) asc;\r\n再gbk字符集中，中文是按拼音排序的\r\n--------------------------------------------------------------\r\npdo详细\r\n---------------------------------------------------------------------------------\r\nPDO是一个“数据库访问抽象层”，作用是统一各种数据库的访问接口，与mysql和mysqli的函数库相比，PDO让跨数据库的使用更具有亲和\r\n\r\n力；与ADODB和MDB2相比，PDO更高效。\r\n目前而言，实现“数据库抽象层”任重而道远，使用PDO这样的“数据库访问抽象层”是一个不错的选择。\r\nPDO中包含三个预定义的类\r\nPDO中包含三个预定义的类，它们分别是 PDO、PDOStatement 和 PDOException。\r\n一、PDO\r\nPDO->beginTransaction() — 标明回滚起始点\r\nPDO->commit() — 标明回滚结束点，并执行SQL\r\nPDO->__construct() — 建立一个PDO链接数据库的实例\r\nPDO->errorCode() — 获取错误码\r\nPDO->errorInfo() — 获取错误的信息\r\nPDO->exec() — 处理一条SQL语句，并返回所影响的条目数\r\nPDO->getAttribute() — 获取一个“数据库连接对象”的属性\r\nPDO->getAvailableDrivers() — 获取有效的PDO驱动器名称\r\nPDO->lastInsertId() — 获取写入的最后一条数据的主键值\r\nPDO->prepare() — 生成一个“查询对象”\r\nPDO->query() — 处理一条SQL语句，并返回一个“PDOStatement”\r\nPDO->quote() — 为某个SQL中的字符串添加引号\r\nPDO->rollBack() — 执行回滚\r\nPDO->setAttribute() — 为一个“数据库连接对象”设定属性\r\n二、PDOStatement\r\nPDOStatement->bindColumn() — Bind a column to a PHP variable\r\nPDOStatement->bindParam() — Binds a parameter to the specified variable name\r\nPDOStatement->bindValue() — Binds a value to a parameter\r\nPDOStatement->closeCursor() — Closes the cursor, enabling the statement to be executed again.\r\nPDOStatement->columnCount() — Returns the number of columns in the result set\r\nPDOStatement->errorCode() — Fetch the SQLSTATE associated with the last operation on the statement handle\r\nPDOStatement->errorInfo() — Fetch extended error information associated with the last operation on the statement handle\r\nPDOStatement->execute() — Executes a prepared statement\r\nPDOStatement->fetch() — Fetches the next row from a result set\r\nPDOStatement->fetchAll() — Returns an array containing all of the result set rows\r\nPDOStatement->fetchColumn() — Returns a single column from the next row of a result set\r\nPDOStatement->fetchObject() — Fetches the next row and returns it as an object.\r\nPDOStatement->getAttribute() — Retrieve a statement attribute\r\nPDOStatement->getColumnMeta() — Returns metadata for a column in a result set\r\nPDOStatement->nextRowset() — Advances to the next rowset in a multi-rowset statement handle\r\nPDOStatement->rowCount() — Returns the number of rows affected by the last SQL statement\r\nPDOStatement->setAttribute() — Set a statement attribute\r\nPDOStatement->setFetchMode() — Set the default fetch mode for this statement\r\nPDO是一个“数据库访问抽象层”，作用是统一各种数据库的访问接口，与mysql和mysqli的函数库相比，PDO让跨数据库的使用更具有亲和\r\n\r\n力；与ADODB和MDB2相比，PDO更高效。目前而言，实现“数据库抽象层”任重而道远，使用PDO这样的“数据库访问抽象层”是一个不错的\r\n\r\n选择。\r\nPDO中包含三个预定义的类\r\nPDO中包含三个预定义的类，它们分别是 PDO、PDOStatement 和 PDOException。\r\n一、PDO\r\nPDO->beginTransaction() — 标明回滚起始点\r\nPDO->commit() — 标明回滚结束点，并执行SQL\r\nPDO->rollBack() — 执行回滚\r\nPDO->__construct() — 建立一个PDO链接数据库的实例\r\nPDO->errorCode() — 获取错误码\r\nPDO->errorInfo() — 获取错误的信息\r\nPDO->exec() — 处理一条SQL语句，并返回所影响的条目数\r\nPDO->getAttribute() — 获取一个“数据库连接对象”的属性\r\nPDO->getAvailableDrivers() — 获取有效的PDO驱动器名称\r\nPDO->lastInsertId() — 获取写入的最后一条数据的主键值\r\nPDO->prepare() — 生成一个“查询对象”\r\nPDO->query() — 处理一条SQL语句，并返回一个“PDOStatement”\r\nPDO->quote() — 为某个SQL中的字符串添加引号\r\nPDO->setAttribute() — 为一个“数据库连接对象”设定属性\r\n详解1) PDO中的数据库连接\r\n$dsn = ‘mysql:dbname=ent;host=127.0.0.1′;\r\n$user = ‘root';\r\n$password = ‘123456′;\r\ntry {\r\n$dbh = new PDO($dsn, $user, $password, array(PDO::ATTR_PERSISTENT => true));\r\n$dbh->query('set names utf8;');\r\nforeach ($dbh->query('SELECT * from tpm_juese') as $row) {\r\nprint_r($row);\r\n}\r\n} catch (PDOException $e) {\r\necho ‘Connection failed: ‘ . $e->getMessage();\r\n}\r\n许多Web应用会因为使用了向数据库的持久连接而得到优化。持久连接不会在脚本结束时关闭，\r\n相反它会被缓存起来并在另一个脚本通过同样的标识请求一个连接时得以重新利用。\r\n持久连接的缓存可以使你避免在脚本每次需要与数据库对话时都要部署一个新的连接的资源消耗，让你的Web应用更加快速。\r\n上面实例中的array(PDO::ATTR_PERSISTENT => true)就是把连接类型设置为持久连接。\r\n详解2) PDO中的事务\r\nPDO->beginTransaction()，PDO->commit()，PDO->rollBack()这三个方法是在支持回滚功能时一起使用的。PDO->beginTransaction()方\r\n\r\n法标明起始点，PDO->commit()方法标明回滚结束点，并执行SQL，PDO->rollBack()执行回滚。\r\n<?php\r\ntry {\r\n$dbh = new PDO('mysql:host=localhost;dbname=test', ‘root', ”);\r\n$dbh->query('set names utf8;');\r\n$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\r\n$dbh->beginTransaction();\r\n$dbh->exec(”INSERT INTO `test`.`table` (`name` ,`age`)VALUES ('mick', 22);”);\r\n$dbh->exec(”INSERT INTO `test`.`table` (`name` ,`age`)VALUES ('lily', 29);”);\r\n$dbh->exec(”INSERT INTO `test`.`table` (`name` ,`age`)VALUES ('susan', 21);”);\r\n$dbh->commit();\r\n} catch (Exception $e) {\r\n$dbh->rollBack();\r\necho “Failed: ” . $e->getMessage();\r\n}\r\n?>\r\n现在你已经通过PDO建立了连接，在部署查询之前你必须搞明白PDO是怎样管理事务的。如果你以前从未遇到过事务处理，（现在简单介绍\r\n\r\n一下：）它们提供了4个主要的特性：原子性，一致性，独立性和持久性（Atomicity, Consistency, Isolation and Durability，ACID）\r\n\r\n通俗一点讲，一个事务中所有的工作在提交时，即使它是分阶段执行的，也要保证安全地应用于数据库，不被其他的连接干扰。事务工作\r\n\r\n也可以在请求发生错误时轻松地自动取消。\r\n事务的典型运用就是通过把批量的改变“保存起来”然后立即执行。这样就会有彻底地提高更新效率的好处。换句话说，事务可以使你的\r\n\r\n脚本更快速同时可能更健壮（要实现这个优点你仍然需要正确的使用它们）。\r\n不幸运的是，并不是每个数据库都支持事务，因此PDO需要在建立连接时运行在被认为是“自动提交”的模式下。自动提交模式意味着你执\r\n\r\n行的每个查询都有它自己隐含的事务处理，无论数据库支持事务还是因数据库不支持而不存在事务。如果你需要一个事务，你必须使用 \r\n\r\nPDO->beginTransaction() 方法创建一个。如果底层驱动不支持事务处理，一个PDOException就会被抛出（与你的异常处理设置无关，因\r\n\r\n为这总是一个严重的错误状态）。在一个事物中，你可以使用 PDO->commit() 或 PDO->rollBack() 结束它，这取决于事务中代码运行是\r\n\r\n否成功。\r\n当脚本结束时或一个连接要关闭时，如果你还有一个未处理完的事务，PDO将会自动将其回滚。这是对于脚本意外终止的情况来说是一个安\r\n\r\n全的方案——如果你没有明确地提交事务，它将会假设发生了一些错误，为了你数据的安全，所以就执行回滚了。\r\n二、PDOStatement\r\nPDOStatement->bindColumn() — Bind a column to a PHP variable\r\nPDOStatement->bindParam() — Binds a parameter to the specified variable name\r\nPDOStatement->bindValue() — Binds a value to a parameter\r\nPDOStatement->closeCursor() — Closes the cursor, enabling the statement to be executed again.\r\nPDOStatement->columnCount() — Returns the number of columns in the result set\r\nPDOStatement->errorCode() — Fetch the SQLSTATE associated with the last operation on the statement handle\r\nPDOStatement->errorInfo() — Fetch extended error information associated with the last operation on the statement handle\r\nPDOStatement->execute() — Executes a prepared statement\r\nPDOStatement->fetch() — Fetches the next row from a result set\r\nPDOStatement->fetchAll() — Returns an array containing all of the result set rows\r\nPDOStatement->fetchColumn() — Returns a single column from the next row of a result set\r\nPDOStatement->fetchObject() — Fetches the next row and returns it as an object.\r\nPDOStatement->getAttribute() — Retrieve a statement attribute\r\nPDOStatement->getColumnMeta() — Returns metadata for a column in a result set\r\nPDOStatement->nextRowset() — Advances to the next rowset in a multi-rowset statement handle\r\nPDOStatement->rowCount() — Returns the number of rows affected by the last SQL statement\r\nPDOStatement->setAttribute() — Set a statement attribute\r\nPDOStatement->setFetchMode() — Set the default fetch mode for this statement\r\n三、PDOException\r\nPDO 提供了3中不同的错误处理策略。\r\n1. PDO::ERRMODE_SILENT\r\n这是默认使用的模式。PDO会在statement和database对象上设定简单的错误代号，你可以使用PDO->errorCode() 和 PDO->errorInfo() 方\r\n\r\n法检查错误；如果错误是在对statement对象进行调用时导致的，你就可以在那个对象上使用 PDOStatement->errorCode() 或 \r\n\r\nPDOStatement->errorInfo() 方法取得错误信息。而如果错误是在对database对象调用时导致的，你就应该在这个database对象上调用那\r\n\r\n两个方法。\r\n2. PDO::ERRMODE_WARNING\r\n作为设置错误代号的附加，PDO将会发出一个传统的E_WARNING信息。这种设置在除错和调试时是很有用的，如果你只是想看看发生了什么\r\n\r\n问题而不想中断程序的流程的话。\r\n3. PDO::ERRMODE_EXCEPTION\r\n作为设置错误代号的附件，PDO会抛出一个PDOException异常并设置它的属性来反映错误代号和错误信息。这中设置在除错时也是很有用的\r\n\r\n，因为他会有效的“放大（blow up）”脚本中的出错点，非常快速的指向一个你代码中可能出错区域。（记住：如果异常导致脚本中断，\r\n\r\n事务处理回自动回滚。）\r\n异常模式也是非常有用的，因为你可以使用比以前那种使用传统的PHP风格的错误处理结构更清晰的结构处理错误，比使用安静模式使用更\r\n\r\n少的代码及嵌套，也能够更加明确地检查每个数据库访问的返回值。\r\n关于PHP中异常的更多信息请看Exceptions章节\r\nPDO 使用基于SQL-92 SQLSTATE 的错误代号字符串；特定的PDO驱动应当将自己本身的代号对应到适当的SQLSTATE代号上。PDO-\r\n\r\n>errorCode() 方法只返回单一的SQLSTATE代号。如果你需要关于一个错误的更加有针对性的信息，PDO也提供了一个PDO->errorInfo()方\r\n\r\n法，它可以返回一个包含了SQLSTATE代号，特定数据库驱动的错误代号和特定数据库驱动的错误说明字符串。\r\n<?php\r\n// 修改默认的错误显示级别\r\n$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);\r\n?>\r\n属性列表：\r\nPDO::PARAM_BOOL\r\n表示一个布尔类型\r\nPDO::PARAM_NULL\r\n表示一个SQL中的NULL类型\r\nPDO::PARAM_INT\r\n表示一个SQL中的INTEGER类型\r\nPDO::PARAM_STR\r\n表示一个SQL中的SQL CHAR，VARCHAR类型\r\nPDO::PARAM_LOB\r\n表示一个SQL中的large object类型\r\nPDO::PARAM_STMT\r\n表示一个SQL中的recordset类型，还没有被支持\r\nPDO::PARAM_INPUT_OUTPUT\r\nSpecifies that the parameter is an INOUT parameter for a stored procedure. You must bitwise-OR this value with an \r\n\r\nexplicit PDO::PARAM_* data type.\r\nPDO::FETCH_LAZY\r\n将每一行结果作为一个对象返回\r\nPDO::FETCH_ASSOC\r\n仅仅返回以键值作为下标的查询的结果集，名称相同的数据只返回一个\r\nPDO::FETCH_NAMED\r\n仅仅返回以键值作为下标的查询的结果集，名称相同的数据以数组形式返回\r\nPDO::FETCH_NUM\r\n仅仅返回以数字作为下标的查询的结果集\r\nPDO::FETCH_BOTH\r\n同时返回以键值和数字作为下标的查询的结果集\r\nPDO::FETCH_OBJ\r\n以对象的形式返回结果集\r\nPDO::FETCH_BOUND\r\n将PDOStatement::bindParam()和PDOStatement::bindColumn()所绑定的值作为变量名赋值后返回\r\nPDO::FETCH_COLUMN\r\n表示仅仅返回结果集中的某一列\r\nPDO::FETCH_CLASS\r\n表示以类的形式返回结果集\r\nPDO::FETCH_INTO\r\n表示将数据合并入一个存在的类中进行返回\r\nPDO::FETCH_FUNC\r\nPDO::FETCH_GROUP\r\nPDO::FETCH_UNIQUE\r\nPDO::FETCH_KEY_PAIR\r\n以首个键值下表，后面数字下表的形式返回结果集\r\nPDO::FETCH_CLASSTYPE\r\nPDO::FETCH_SERIALIZE\r\n表示将数据合并入一个存在的类中并序列化返回\r\nPDO::FETCH_PROPS_LATE\r\nAvailable since PHP 5.2.0\r\nPDO::ATTR_AUTOCOMMIT\r\n在设置成true的时候，PDO会自动尝试停止接受委托，开始执行\r\nPDO::ATTR_PREFETCH\r\n设置应用程序提前获取的数据大小，并非所有的数据库哦度支持\r\nPDO::ATTR_TIMEOUT\r\n设置连接数据库超时的值\r\nPDO::ATTR_ERRMODE\r\n设置Error处理的模式\r\nPDO::ATTR_SERVER_VERSION\r\n只读属性，表示PDO连接的服务器端数据库版本\r\nPDO::ATTR_CLIENT_VERSION\r\n只读属性，表示PDO连接的客户端PDO驱动版本\r\nPDO::ATTR_SERVER_INFO\r\n只读属性，表示PDO连接的服务器的meta信息\r\nPDO::ATTR_CONNECTION_STATUS\r\nPDO::ATTR_CASE\r\n通过PDO::CASE_*中的内容对列的形式进行操作\r\nPDO::ATTR_CURSOR_NAME\r\n获取或者设定指针的名称\r\nPDO::ATTR_CURSOR\r\n设置指针的类型，PDO现在支持PDO::CURSOR_FWDONLY和PDO::CURSOR_FWDONLY\r\nPDO::ATTR_DRIVER_NAME\r\n返回使用的PDO驱动的名称\r\nPDO::ATTR_ORACLE_NULLS\r\n将返回的空字符串转换为SQL的NULL\r\nPDO::ATTR_PERSISTENT\r\n获取一个存在的连接\r\nPDO::ATTR_STATEMENT_CLASS\r\nPDO::ATTR_FETCH_CATALOG_NAMES\r\n在返回的结果集中，使用自定义目录名称来代替字段名。\r\nPDO::ATTR_FETCH_TABLE_NAMES\r\n在返回的结果集中，使用自定义表格名称来代替字段名。\r\nPDO::ATTR_STRINGIFY_FETCHES\r\nPDO::ATTR_MAX_COLUMN_LEN\r\nPDO::ATTR_DEFAULT_FETCH_MODE\r\nAvailable since PHP 5.2.0\r\nPDO::ATTR_EMULATE_PREPARES\r\nAvailable since PHP 5.1.3.\r\nPDO::ERRMODE_SILENT\r\n发生错误时不汇报任何的错误信息，是默认值\r\nPDO::ERRMODE_WARNING\r\n发生错误时发出一条php的E_WARNING的信息\r\nPDO::ERRMODE_EXCEPTION\r\n发生错误时抛出一个PDOException\r\nPDO::CASE_NATURAL\r\n回复列的默认显示格式\r\nPDO::CASE_LOWER\r\n强制列的名字小写\r\nPDO::CASE_UPPER\r\n强制列的名字大写\r\nPDO::NULL_NATURAL\r\nPDO::NULL_EMPTY_STRING\r\nPDO::NULL_TO_STRING\r\nPDO::FETCH_ORI_NEXT\r\n获取结果集中的下一行数据，仅在有指针功能时有效\r\nPDO::FETCH_ORI_PRIOR\r\n获取结果集中的上一行数据，仅在有指针功能时有效\r\nPDO::FETCH_ORI_FIRST\r\n获取结果集中的第一行数据，仅在有指针功能时有效\r\nPDO::FETCH_ORI_LAST\r\n获取结果集中的最后一行数据，仅在有指针功能时有效\r\nPDO::FETCH_ORI_ABS\r\n获取结果集中的某一行数据，仅在有指针功能时有效\r\nPDO::FETCH_ORI_REL\r\n获取结果集中当前行后某行的数据，仅在有指针功能时有效\r\nPDO::CURSOR_FWDONLY\r\n建立一个只能向后的指针操作对象\r\nPDO::CURSOR_SCROLL\r\n建立一个指针操作对象，传递PDO::FETCH_ORI_*中的内容来控制结果集\r\nPDO::ERR_NONE (string)\r\n设定没有错误时候的错误信息\r\nPDO::PARAM_EVT_ALLOC\r\nAllocation event\r\nPDO::PARAM_EVT_FREE\r\nDeallocation event\r\nPDO::PARAM_EVT_EXEC_PRE\r\nEvent triggered prior to execution of a prepared statement.\r\nPDO::PARAM_EVT_EXEC_POST\r\nEvent triggered subsequent to execution of a prepared statement.\r\nPDO::PARAM_EVT_FETCH_PRE\r\nEvent triggered prior to fetching a result from a resultset.\r\nPDO::PARAM_EVT_FETCH_POST\r\nEvent triggered subsequent to fetching a result from a resultset.\r\nPDO::PARAM_EVT_NORMALIZE\r\nEvent triggered during bound parameter registration allowing the driver to normalize the parameter name\r\n---------------------------------------------------------------------------------------------------------------------\r\nredis windows 下介绍\r\n\r\n-------------------------------------------------------------------------------------------------------------------\r\n下载压缩包 解压，\r\n打开dos窗口，进入解压目录 \r\nredis-server.exe redis.conf 启动redis redis.conf 可以不用，用默认配置\r\n另外开启一个窗口\r\nredis-cli.exe -h 202.117.16.133 -p 6379 开启客户端 -h 后跟本机目录127.0.0.1 -p 是端口\r\n------------------------------------------------------------------------------------------------\r\nmysql 删除重复记录\r\ndelete test6 from test6 left join (select id s_id,ship_type_code st from test6 group by st) b on id=s_id where st is \r\n\r\nnull;\r\n----------------------------------------------------------------------------------------\r\nngix 相关\r\ncd nginx\r\n\r\nstart nginx\r\n\r\n这样，nginx 服务就启动了。打开任务管理器，查看 nginx.exe 进程，有二个进程会显示，占用系统资源，那是相当的少。然后再打开浏\r\n\r\n览器，输入 http://127.0.0.1/  就可以看到nginx的欢迎页面了，非常友好\r\n\r\nnginx -s stop          // 停止nginx\r\nnginx -s reload       // 重新加载配置文件\r\nnginx -s quit          // 退出nginx\r\nnginx php 打开\r\nE:/nginx/php5这个是php安装路径，首先要把这个设置到环境变量\r\nE:\\nginx\\php5\\php-cgi.exe -b 127.0.0.1:9000 -c E:/nginx/php5/php.ini\r\n--------------------------------------------------------------------------------------------------------\r\nphpExcel\r\n字符以文本形式\r\n $objActSheet->setCellValueExplicit('E3','44030520585000',PHPExcel_Cell_DataType::TYPE_STRING);\r\n $objActSheet->getStyle('E3')->getNumberFormat()->setFormatCode(\"@\");\r\n -------------------------------------------------------------------------------------------------------\r\n js 阻止默认浏览器动作\r\n function stopPrevent(event){\r\n\t\tif(event && event.preventDefault) {\r\n\t　　\t\t\t//阻止默认浏览器动作(W3C)\r\n\t　　\t\t\tevent.preventDefault();\r\n\t\t\t} else {\r\n\t\t\t　　//IE中阻止函数器默认动作的方式\r\n\t\t\t　　window.event.returnValue = false;\r\n\t\t\t}\r\n\t\t\t\t\treturn false;\r\n }\r\n------------------------------------------------------------------------------------------------------------\r\nMYSQL查询一个表的所有字段为一个字符串\r\nselect group_concat(COLUMN_NAME) from information_schema.COLUMNS\r\nwhere table_name = '表名'\r\nand table_schema = '数据库名';\r\n-------------------------------------------------------------------------------------------------------------\r\najax 跨域请求\r\n客户端代码实例\r\n<script type=\"text/javascript\">\r\nfunction sed(){\r\n\t$.ajax({\r\n\t\turl:'http://www.iship2.com/adminuser/user/ajax',\r\n\t\ttype:'GET',\r\n\t\tdataType:'jsonp',\r\n\t\tjsonp:'callback',\r\n\t\tsuccess:function(json){\r\n\t\t\talert(json);\r\n\t\t}\r\n\t\r\n\t})\r\n\r\n}\r\n\r\n</script>\r\n服务端代码：\r\n\t\t$callBack=$_GET['callback'];\r\n\t\t$arra=array(1,2,3);\r\n\t\techo $callBack.'(\\''.json_encode($arra).'\\')';\r\n------------------------------------------------------------------------------------------------------------------\r\n打开错误信息\r\nif( !ini_get('display_errors') ) {\r\n\t\t\tini_set('display_errors', 'On');\r\n\t\t}\r\nerror_reporting(E_WARNING | E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING);\r\n------------------------------------------------------------------------------------------------------------------\r\n判断文件utf8有没有bom\r\nfunction checkBOM ($filename) {\r\nglobal $auto;\r\n$contents=file_get_contents($filename);\r\n$charset[1]=substr($contents, 0, 1);\r\n$charset[2]=substr($contents, 1, 1);\r\n$charset[3]=substr($contents, 2, 1);\r\nif (ord($charset[1])==239 && ord($charset[2])==187 && ord($charset[3])==191) {\r\nif ($auto==1) {\r\n$rest=substr($contents, 3);\r\nrewrite ($filename, $rest);\r\nreturn (\"<font color=red>BOM found, automatically removed.</font>\");\r\n} else {\r\nreturn (\"<font color=red>BOM found.</font>\");\r\n}\r\n}\r\nelse return '';\r\n}\r\n--------------------------------------------------------------------------------------------------------\r\npdf自动打印\r\n  $js= 'print({bUI: false,bSilent: true,bShrinkToFit: true});\r\n添加js，\r\nfpdi ->includeJs($js);\r\n-------------------------------------------------------------------------------------------------\r\n数组转xml\r\npublic static function data2XML(array $data, SimpleXMLElement $xml, $child = \"printData\")\r\n    {\r\n\r\n        foreach($data as $key => $val) {\r\n            if(is_array($val)) {\r\n                if(is_numeric($key)) {\r\n                    $node  = $xml->addChild($child);\r\n                    $nodes = $node->getName($child);\r\n                } else {\r\n\r\n                    $node  = $xml->addChild($key);\r\n                    $nodes = $node->getName($key);\r\n                }\r\n               self::data2Xml($val, $node,$child);\r\n            } else {\r\n                $xml->addChild($key, $val);\r\n            }\r\n        }\r\n\t\treturn $xml;\r\n\r\n    }\r\n------------------------------------------------------------------------------------------------------------\r\nckplayer\r\n-------------------------------------------------------------------------------------------------\r\nerror_reporting(0);\r\n$AccountID = $_SERVER['PHP_AUTH_USER'];\r\n$AccountPassword = $_SERVER['PHP_AUTH_PW'];\r\nif(!\r\n\r\n($AccountID=='111'&& $AccountPassword=='222'))\r\n{\r\n    header('WWW-Authenticate: Basic realm=\"天使的思念\"');\r\n    header\r\n\r\n('HTTP/1.0 401 Unauthorized');\r\n    echo '验证失败';\r\n    exit;\r\n}\r\nelse\r\n{\r\n    echo '验证成功！';\r\n}\r\n------------------------------------------------------------------------------------------------------------\r\njs防止客户端查看源码\r\n<html> \r\n<head> \r\n<script> \r\nfunction clear(){ \r\nSource=document.body.firstChild.data;\r\ndocument.open(); \r\ndocument.close(); \r\ndocument.title=\"就是不给您看\"; \r\ndocument.body.innerHTML=Source; \r\n}</script> \r\n</head> \r\n<body onload=clear()> \r\n    不还意思，妹子有点害羞，不给您看\r\n</body> \r\n</html>\r\n----------------------------------------------------------------------------------------------------------\r\n判断是否手机登陆\r\nfunction is_mobile_request()  \r\n \r\n{  \r\n \r\n$_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';  \r\n \r\n$mobile_browser = '0';  \r\n \r\nif(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i', strtolower\r\n\r\n($_SERVER['HTTP_USER_AGENT'])))  \r\n \r\n  $mobile_browser++;  \r\n \r\nif((isset($_SERVER['HTTP_ACCEPT'])) and (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') !== \r\n\r\nfalse))  \r\n \r\n  $mobile_browser++;  \r\n \r\nif(isset($_SERVER['HTTP_X_WAP_PROFILE']))  \r\n \r\n  $mobile_browser++;  \r\n \r\nif(isset($_SERVER['HTTP_PROFILE']))  \r\n \r\n  $mobile_browser++;  \r\n \r\n$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));  \r\n \r\n$mobile_agents = array(  \r\n \r\n      'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',  \r\n \r\n      'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',  \r\n \r\n      'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',  \r\n \r\n      'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',  \r\n \r\n      'newt','noki','oper','palm','pana','pant','phil','play','port','prox',  \r\n \r\n      'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',  \r\n \r\n      'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',  \r\n \r\n      'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',  \r\n \r\n      'wapr','webc','winw','winw','xda','xda-'\r\n \r\n      );  \r\n \r\nif(in_array($mobile_ua, $mobile_agents))  \r\n \r\n  $mobile_browser++;  \r\n \r\nif(strpos(strtolower($_SERVER['ALL_HTTP']), 'operamini') !== false)  \r\n \r\n  $mobile_browser++;  \r\n \r\n// Pre-final check to reset everything if the user is on Windows  \r\n \r\nif(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') !== false)  \r\n \r\n  $mobile_browser=0;  \r\n \r\n// But WP7 is also Windows, with a slightly different characteristic  \r\n \r\nif(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows phone') !== false)  \r\n \r\n  $mobile_browser++;  \r\n \r\nif($mobile_browser>0)  \r\n \r\n  return true;  \r\n \r\nelse\r\n \r\n  return false;  \r\n \r\n}\r\n-------------------------------------------------------------------------------------------------------\r\n文件bom头\r\n  fwrite($fp,chr(0xEF).chr(0xBB).chr(0xBF));  \r\n-----------------------------------------------------------------------------------------------------------\r\n导出Word以大纲形式打开\r\n<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"  xmlns:w=\"urn:schemas-microsoft-com:office:word\"  \r\n\r\nxmlns=\"http://www.w3.org/TR/REC-html40\">\r\n  <head>\r\n\t   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\r\n\t   <xml><w:WordDocument><w:View>Print</w:View></xml>\r\n\t   <style type=\"text/css\">\r\n\t\tbody{font-size:15px;}\r\n\t   </style>\r\n</head>\r\n\r\n-------------------------------"}}