搜尋
首頁後端開發php教程ExtPHP主要用於透過PHP程式碼產生ExtJS的JavaScript程式碼

ExtPHP是一個基於Thinkphp開發框架的ExtJS開發類別庫,使用這類程式庫可以很方便的產生ExtJS的JavaScript程式碼。
  1. /**
  2. * PHPExtJs 基礎對象
  3. * @License: ( http://www.apache.org/licenses/LICENSE-2.0 )
  4. * @Author: wb
  5. */
  6. class ExtBase {
  7. /**
  8. * ExtJS的基本目錄,此參數為路徑
  9. * @var String
  10. */
  11. public $exthome = '';
  12. /**
  13. * ExtJS的語言環境配置,預設為zh_cn (中文)
  14. * @var String
  15. */
  16. public $extlang = 'zh_cn';
  17. /**
  18. * ExtJS的調試模式,預設為false
  19. * @var Boolean
  20. */
  21. public $demode = falsebug
  22. * ExtJS的核心模式,預設為false
  23. * @var Boolean
  24. */
  25. public $demode = falsebug
  26. * ExtJS的環境目錄的基準目錄
  27. * @var String
  28. */
  29. public $demode = falsebug
  30. * ExtJS的基本程式碼
  31. * @var String
  32. */
  33. public $demode = falsebug
  34. * 頁面所需的Css檔
  35. * @var Array
  36. */
  37. public $demode = false 是> /**
  38. * 頁面所需的Js檔
  39. * @var Array
  40. */
  41. public $coremode = false;
  42. /**
  43. * ExtJs的css檔
  44. * @var String
  45. */
  46. public $extbasedir = "";
  47. /**
  48. * ExtJS目錄下的所有檔案索引 格式為:array(檔案名稱=>檔案路徑)
  49. * @var Array
  50. * /
  51. public $extbasecode = "";
  52. /**
  53. * 定義ExtJS的基本運作檔案格式為:array(name=>檔案名稱),這裡只是定義了基本的幾個
  54. * 如:base,all,css,core,debug
  55. * @ var Array
  56. */
  57. public $pageCss = array();
  58. /**
  59. * 依照基本參數設定Extjs的基本環境
  60. *
  61. * @param string $exthome ExtJS所在目錄,相對於$basedir所指定的目錄
  62. * @param boolen $extdebue 是否開啟調試模式
  63. * @param boolen $extcore 是否是core模式
  64. * @param string $extlang 設定ExtJS語言
  65. * @param string $basedir $exthome目錄所在的目錄
  66. */
  67. public $pageJs = array();
  68. /**
  69. * 設定Extjs的基本目錄
  70. *
  71. * @param String $exthome ExtJs檔案所在的目錄
  72. * @param String $basedir 所在目錄是基於該目錄預設為'/'
  73. * @return Boolean
  74. */
  75. private $extcss = "";
  76. /***/
  77. public $ExtALLFiels = array();
  78. /***/
  79. public $ExtBaseFile = array(
  80. 'base' => 'ext-base.js',
  81. 'all' => 'ext-all.js ',
  82. 'css' => 'ext-all.css',
  83. 'core' => 'ext-core.js',
  84. 'debug' => 'ext-all- debug.js',
  85. );
  86. /***/
  87. public function __construct($exthome = '', $basedir='', $extdebue=false, $extcore=false, $extcn='zh_' ) {
  88. //設定基本運作環境
  89. $this->setExtBase($exthome, $basedir, $extdebue, $extcore, $extlang);
  90. }
  91. /*** /
  92. public function setExtHome($exthome="", $basedir="/") {
  93. //TODO - 設定Extjs 的基本目錄
  94. if (!empty($ basedir)) {
  95. $this->extbasedir = str_replace("/./", "/", $basedir);
  96. }
  97. if (!empty($exthome)) { $this->ReadALLFile($exthome , $this->ExtALLFiels); if (!empty($this->ReadALLFile[$this->ExtBaseFile['base']])) { throw new Exception("不正確的exthome目錄( $exthome)!");
  98. }
  99. $this->exthome = $exthome;
  100. }
  101. return TRUE;
  102. }
  103. /**
  104. * 設定Extjs的基本環境
  105. *
  106. * @param string $exthome ExtJS所在目錄,相對於$basedir所指定的目錄
  107. * @param boolen $extdebue 是否開啟模式
  108. * @param boolen $extcore 是否是core模式
  109. * @param string $extlang 設定ExtJS語言
  110. * @param string $basedir $exthome目錄所在的目錄
  111. * @return Boolean
  112. */
  113. 公用函數 setExtBase ($exthome = '', $basedir='', $extdebue=false, $extcore=false, $extlang='zh-CN') {
  114. //設定Extjs的基本環境
  115. $this- > setExtHome($exthome, $basedir);
  116. $this->setExtLang($extlang);
  117. $this->debugmode = $extdebue;
  118. return TRUE;
  119. }
  120. /**
  121. * 設定extjs的語言
  122. *
  123. * @param String $lang 這裡的語言只能是ExtJs中語言檔案的檔案名稱中的語言部分,如:
  124. * ext-lang-zh_cn .js語言文件,只要zh_cn就行
  125. */
  126. public function setExtLang($lang='') {
  127. //TODO - 設定extjs 的語言
  128. if (!empty($lang))
  129. $ this->extlang = $lang;
  130. }
  131. /**
  132. * 取得物件的Styel設定字串
  133. */
  134. public function getExtBaseStyel() {
  135. $tmpstr = '';
  136. if (is_array($ this->ExtALLFiels[ $this->ExtBaseFile['css']])) {
  137. $cssfile = '';
  138. foreach ($this->ExtALLFiels[$this->ExtBaseFile['css']] as $v) {
  139. if (preg_match('//docs/i', $v) == FALSE) {
  140. $cssfile = $v;
  141. break;
  142. }
  143. }
  144. $tmpstr .= "n";
  145. } else {
  146. $tmpstr .= " n";
  147. }
  148. //設定其他css
  149. if (!empty($this->pageCss)) {
  150. foreach ($ this->pageCss as $f) {
  151. if (is_array($ f)) {
  152. $tmpstr .= "
複製程式碼
  1. /**
  2. * PHPExtJs的對像生成類
  3. * @License: ( http://www.apache.org/licenses/LICENSE-2.0 )
  4. * @Author: wb
  5. */
  6. class ExtFunction {
  7. /**
  8. * 物件的參數集
  9. * @var Array 參數集
  10. */
  11. protected $param = array();
  12. /**
  13. * 物件碼
  14. * @var String 物件程式碼字串
  15. */
  16. protected $code = '';
  17. /**
  18. * JS物件表示法的名稱
  19. * @var String 物件名稱
  20. */
  21. protected $clsname = ' ';
  22. /**
  23. * 依照參數$param、代碼$code和$clsnames設定Ext function物件
  24. *
  25. * @param Mixed $param function的參數清單如:"val,val1" 或array("val", "val1")
  26. * @param Mixed $code functiond的程式碼,可以跟物件
  27. * @param String $clsname Ext自訂物件名稱
  28. *
  29. */
  30. public function __construct($param = null, $code = null, $clsname = null) {
  31. $this->SetParam( $param );
  32. $this->SetCode($code);
  33. $this->clsname = $clsname;
  34. }
  35. /**
  36. * 設定物件的參數
  37. * @param String $param 參數 可以是陣列
  38. */
  39. 公用函數SetParam($param) {
  40. if (is_array($param)) {
  41. $this->param = array_merge($this->param, $param);
  42. } elseif (is_string($param) && preg_match("/,/", $param)) {
  43. $this->param = array_merge($this->param, split(',', $param));
  44. } else {
  45. $this->param [$param] = $param;
  46. }
  47. }
  48. /**
  49. * 設定物件的代碼
  50. * @param Mixed $code 可以是代碼串或是PHPExtJS的其它物件
  51. */
  52. 公用函數SetCode ($code) {
  53. if (!empty($this->code) && is_object($this->code) && method_exists($this->code, 'render')) {
  54. $this->程式碼= $this->code->render();
  55. }
  56. if (is_object($code) && method_exists($code, 'render')) {
  57. $this->code .= $code->render();
  58. } else if (is_string($code)) {
  59. $this->code .= $code;
  60. }
  61. if (is_array($code ) )) {
  62. foreach ($code as $key =>; $val) {
  63. if ($key === "return") {
  64. //echo "KEY:$key
    n ";
  65. $this->code .= "return " ;
  66. }
  67. $this->SetCode($val);
  68. $this->code .= ";";
  69. }
  70. }
  71. }
  72. /**
  73. * @param String $name DOM名稱
  74. * @param String $clsname 物件名稱
  75. */
  76. public function render($name = '', $clsname = "") {
  77. $str = ' ';
  78. if (!empty($name) ) {
  79. $str .= "var $name = 函數";
  80. } else {
  81. $str .= "函數";
  82. }
  83. if (!empty($clsname))
  84. $this->clsname = $clsname;
  85. if (!empty($this->clsname)) {
  86. $str . = " " 。 $這個->參數)。 " )";
  87. if (!empty($this->code)) {
  88. $str .= "{";
  89. if (is_object($this->code) && method_exists($this - >code, "render")) {
  90. $str .= $this->code->render();
  91. } elseif (is_string($this->code)) {
  92. $str .= $this->code;
  93. }
  94. $str .= "}";
  95. }
  96. if (!empty($name))
  97. $str .= ";";
  98. // 刪除註解行
  99. $search = array(
  100. '/(//.*)|(/*.**/)/i', // 刪除註解
  101. '/[fnrt] */i', // 去掉回車符
  102. '/{(s)*/i',
  103. '/}(s)*}/i',
  104. ' /}(s)* /i',
  105. //'/}(s)*if/i',
  106. '/(s)*}/',
  107. '/;(s)* /',
  108. '/,(s)*/i'
  109. );
  110. $replace = array(
  111. '',
  112. '',
  113. '{',
  114. '}}',
  115. '}',
  116. //'}if',
  117. '}',
  118. ';',
  119. ','
  120. );
  121. $str = preg_replace( $search, $replace, $str);
  122. return $str;
  123. }
  124. public function __toString() {
  125. return $this->render();
  126. }
  127. }
  128. ?>
}?> 🎜>複製程式碼
  1. require_once 'ExtData.class.php';
  2. class ExtObject { public $state = Array();
  3. public $showkeys = true;
  4. public $extClass = '';
  5. public $rendername = '';
  6. public $extend = '';
  7. /**
  8. * 根據$properties屬性建立Ext物件
  9. *
  10. * @param String $ExtClass 物件名稱如:Ext.TabPanel、Ext.grid.GridPanel 等
  11. * @param Array $properties 物件屬性陣列如:
  12. * Array('labelWidth' => 150,
  13. * 'url' => 'part.submit.php',
  14. * 'frame' => true,
  15. * 'bodyStyle' => 'padding: 5px 5px 0',
  16. * 'width' => 500,
  17. * 'defaults' => new ExtObject(null, Array('width' => 290)),
  18. * 'defaultType' => 'textfield'
  19. * )
  20. * @param String $name var名稱例如:$name='test',則產生為var test = new $ExtClass () {} 的程式碼
  21. * @param Boolen $showkeys 是否顯示配置數組$properties的標籤
  22. */
  23. public function __construct($ExtClass = null, $properties = null, $name = null, $showkeys = true) {
  24. $this this this ->extClass = $ExtClass;
  25. if (is_array($properties)) {
  26. $this->state = $properties;
  27. }
  28. $this->showkeys = $showkeys ;
  29. }
  30. $this->showkeys = $showkeys ;
  31. $this->rendername = $name;
  32. }
  33. /**
  34. * 設定物件的屬性 即 $key = $val;
  35. *
  36. * @param String $key 屬性名稱 必須符合ExtJS個物件的規定
  37. * @param Anly_type $val
  38. */
  39. public function __set($key, $val) {
  40. if ($key == '縮排') {
  41. $this->indent = $val;
  42. } else {
  43. $this->state [$key] = $val;
  44. }
  45. }
  46. public function __get($key) {
  47. if (isset($this->state[$key]))
  48. return $this->state [$key ];
  49. }
  50. public function __isset($key) {
  51. return isset($this->state [$key]);
  52. }
  53. public function del($key) {
  54. $ this->__unset($key);
  55. }
  56. public function __unset($key) {
  57. unset($this->state [ $key]);
  58. }
  59. public function __toString() {
  60. return $this->render();
  61. }
  62. /**
  63. * 設定屬性$name的屬性值為 $property
  64. *
  65. * @param String $name 屬性名稱
  66. * @param Mixed $property 屬性值
  67. */
  68. public function setProperty($name, $屬性) {
  69. if (!empty($name)) {
  70. $this->state [$name] = $property;
  71. }
  72. }
  73. /**
  74. * 依照組態陣列$properties設定ExtClass屬性
  75. *
  76. * @param ConfigArray $properties 設定陣列
  77. */
  78. public function setProperties($properties) {
  79. $this->state = array_merge($this->state, $properties );
  80. }
  81. public fClasstion set. ( $ExtClass) {
  82. $this->extend = $ExtClass;
  83. }
  84. public function JSRender($items, $showkeys = true, $isparam = false) {
  85. // self ::$indent .= ' ';
  86. $str = '';
  87. $total = count($items);
  88. $cnt = 1;
  89. if ($isparam && $total = = 2 && is_object($items [0]) && is_array($items [1])) {
  90. $str .= "{{$this ->JSRender($items[0])}},";
  91. $str .= "[{$this->JSRender($items[1])}]";
  92. } else {
  93. foreach ($items as $element =>; $value) {
  94. if ($showkeys) {
  95. if (is_numeric($showkeys)) {
  96. $str .= self::$indent 。 else {
  97. if (!is_numeric($element))
  98. $str .= self::$indent 。 "$element: ";
  99. }
  100. }
  101. if (is_string($valueue )) {
  102. $str .= "'$value'";
  103. } else if (is_bool($value)) {
  104. $str .= ( $value) ? "true" : "false";
  105. } else if (is_object($value)) {
  106. if (method_exists($value, 'render')) {
  107. $str .= $value->; render();
  108. }
  109. } else if (is_array($value)) {
  110. if (count($value) == 1 && is_string($value [0])) {
  111. $ str .= $value [0];
  112. }else {
  113. $str .= "[";
  114. $str .= $this->JSRender($value, false);
  115. $str .= self::$indent 。 🎜> }
  116. } else if (is_numeric($value)) {
  117. $str .= $value;
  118. } else if ($value == '') {
  119. $str .= " ''";
  120. } else {
  121. $str .= $value;
  122. }
  123. if ($cnt != $total) {
  124. $str .= " ,";
  125. }
  126. $cnt++;
  127. }
  128. }
  129. self::$indent = substr(self::$indent, 0, - 2);
  130. return $str ;
  131. }
  132. /**
  133. * 傳回建構好的ExtJs物件的Js程式碼
  134. *
  135. * @param String $name
  136. * @return String
  137. */
  138. public function render($name = null) {
  139. $str = '';
  140. if (!empty($ name))
  141. $this->rendername = $name;
  142. if (
  143. preg_match('/.alert/', $this->extClass) || preg_match('/.提示/', $this- >extClass)
  144. || preg_match('/.show/', $this->extClass) || preg_match('/.confirm/', $this->extClass)
  145. || preg_match('/.進度/', $this->extClass) || preg_match('/.wait/', $this->extClass)
  146. || preg_match('/.updateProgress/', $this->extClass)
  147. || preg_match('/.updateText/', $this->extClass)
  148. ) {
  149. if (!empty($this->rendername))
  150. $str = self::$indent 。 var $this->rendername = $this->extClass(";
  151. else
  152. $str = self::$indent 。 "$this->extClass (";
  153. $str . = $this->JSRender($this->state, FALSE);
  154. $str .= ");";
  155. } elseif (
  156. preg_match('/.ColumnModel/', $this -> extClass) || preg_match('/.Record.create/', $this->extClass)
  157. ) {
  158. if (!empty($this->rendername))
  159. $ str = self:: $縮排。 "var $this->rendername = new $this->extClass([";
  160. else
  161. $str = self::$indent 。 "new $this-> ;extClass ([";
  162. $ str .= $this->JSRender($this->state, TRUE);
  163. $str .= "])";
  164. if ($this-> >rendername) {
  165. $str .= ";";
  166. }
  167. } elseif (
  168. preg_match('/.JsonReader/', $this->extClass) || preg_match(' /.ArrayReader/', $this->extClass)
  169. ) {
  170. if (!empty($this->rendername))
  171. $str = self::$indent 。 "var $this->rendername = new $this->extClass(";
  172. else
  173. $str = self::$indent . "new $this->extClass (";
  174. if (!empty($this->state['fields'])) {
  175. $str .= "{totalProperty:'" . $this->state['totalProperty'] "', ";
  176. $str .= "root:'" . },";
  177. $str .= "[ " . $this->JSRender($this ->state['fields'], TRUE) . "]";
  178. } else {
  179. $str .= $this->JSRender($this->state , TRUE);
  180. }
  181. $str .= ")";
  182. if ($this->rendername) {
  183. $str . = ";";
  184. }
  185. } elseif ($this->rendername) ;extend) { //如果是擴充物件
  186. $str = self::$indent $this->extClass . = Ext.extend( $this->extend ,{";
  187. $str .= $this->JSRender($this->state, TRUE);
  188. $str .= "});";
  189. } else {
  190. if ($this->rendername ) {
  191. if ($this->extClass) {
  192. $str = self::$indent 。 "var $this->rendername = new $this->extClass({";
  193. } else {
  194. $str = self::$indent 。
  195. }
  196. } elseif ($this->extClass) {
  197. echo self::$indent;
  198. $str = self::$indent "new $this->extClass({ ";
  199. } else {
  200. $str = self::$indent . "{";
  201. }
  202. $str .= $this->JSRender($this->state, $this->showkeys) ;
  203. $str .= self::$indent . "}";
  204. if ($this->extClass) {
  205. $str .= ")";
  206. }
  207. if ($this->rendername) {
  208. $str .= ";";
  209. }
  210. }
  211. return $str;
  212. }
  213. }
  214. ?>
複製程式碼
  1. /**
  2. * PHPExtJs ExtJs頁面物件
  3. * @License: ( http://www.apache.org/licenses/LICENSE-2.0 )
  4. * @Author: wb
  5. * @Author: wb
  6. */
  7. class ExtPage {
  8. public $extjs = '';
  9. public $ extbase = '';
  10. public $body = '';
  11. public $bodyPapm = '';
  12. public $title = '';
  13. public $charset = '';
  14. public $ template = "";
  15. /**
  16. * 根據頁面模板輸出extjshtml程式碼
  17. * 模板中可以包含{charset},{title},{extbase},{extjs},{body}
  18. *
  19. * @param String $title頁面標題
  20. * @param String $extjs extjs代碼
  21. * @param String $body 頁面body
  22. * @param String $charset 頁面編碼設置,預設為UTF-8
  23. * @param String $ template 頁面模板
  24. */
  25. public function __construct($title='', $extjs='', $extbase='', $body='', $charset = 'utf-8', $template='') {
  26. $this->title = $title;
  27. $this->extjs = $extjs;
  28. $this->extbase = $extbase;
  29. $this->body = $body;
  30. $this->charset = $charset;
  31. if(!empty($template)) $this->template = $template ;
  32. else $this ->template = "
  33. {title }
  34. {extbase}
  35. {extjs}
  36. {body}
  37. ";
  38. }
  39. public function render() {
  40. if(!empty( $ this->template)){
  41. $search = array("{charset}","{title}", "{extbase}","{extjs}","{body}","{bodyPapm} " );
  42. $replace = array($this->charset,$this->title,$this->extbase,$this->extjs,$this->body,$this->bodyPapm);
  43. $this->template = str_replace($search,$replace,$this->template );
  44. echo $this->template;
  45. }else{
  46. throw new Exception("頁面模板為空,請先設定頁面模板!");
  47. }
  48. }
  49. public function __set($key, $val) {
  50. switch($key) {
  51. case 'extjs ' :
  52. $this->extjs = $val;
  53. break ;
  54. case 'body':
  55. $this->body = $val;
  56. break;
  57. case 'bodyPapm ' :
  58. $this->bodyPapm = $val;
  59. 中斷;
  60. case '字元集':
  61. $this->body = $val;
  62. 中斷;
  63. case '模板':
  64. $this->template = $val;
  65. break;
  66. case 'extbase':
  67. $this->extbase = $val;
  68. break;
  69. default:
  70. throw new Exception("非法的ExtPage 屬性 ExtPage: : $key");
  71. }
  72. }
  73. public function __get($key) {
  74. switch($key) {
  75. case 'extjs':
  76. return $this this) {
  77. case 'extjs':
  78. return $this this ->extjs;
  79. case 'body':
  80. return $this->body;
  81. case 'bodyPapm':
  82. return $this->bodyPapm;
  83. case 'charset':
  84. return $this->charset;
  85. case 'template':
  86. return $this->template;
  87. default:
  88. throw new Exception("非法的ExtPage 屬性ExtPage ::$key") ;
  89. }
}
}
複製程式碼
  1. /**
  2. * +--------------------------------------------- ----------- --------------------------
  3. * | PHPExtJs
  4. * +-- -------------------------------------------------- ---- --------------------------
  5. * | @License: ( http://www.apache.org/licenses /LICENSE-2.0 )
  6. * +------------------------ ---------------- ------------------------------------------
  7. * | @作者: wb
  8. * +------------------------------------- ----------- --------------------------------------- -----------
  9. */
  10. class ExtData 擴充 ExtBase {
  11. public $Data = array () > public; $DataName = '';
  12. public $isGridData = false
  13. $this->setDataArray( $DataArray ); is_bool ( $isGridData )) {
  14. $this->isGridData = $isGridData;
  15. }
  16. }
  17. /**
  18. * 新建ExtJs的資料集,如果是表格資料在自動格式化為表格的Json的資料格式
  19. *
  20. * @param Array $DataArray 資料集
  21. * @param String $DataName 資料集名稱
  22. * @param Blooen $isGridData 是否是表格資料
  23. */
  24. public function setDataArray($DataArray) {
  25. if (!empty ( $DataArray ) && is_array ( $DataArray )) {
  26. $ this ->Data = $DataArray; public function getJavascript() {
  27. $str='';
  28. if(!empty($this->DataName)){
  29. $str.="var$this - >DataName=";
  30. }
  31. if ($this->isGridData) {
  32. $j = 0;
  33. $count = count($this->Data); $count,root: [ ";
  34. foreach($this->Data as $value) {
  35. if($j>0) $str.=","; ".$this->JSRender($value)."] " ;
  36. $j++;
  37. }
  38. $str.="]}";
  39. } else {
  40. $ str .= "[".$this->JSRender($this- > Data)."]";
  41. //$str .= $this->;JSRender($this->Data);
  42. }
  43. if ( ! 空( $this - > DataName )) {
  44. $str . = " ; " ;
  45. }
  46. return $str ; public function JSRender($Data = Array()) {
  47. $str = "";
  48. for數據資料為$element => $value ) {
  49. if(!empty($str) ) $str .= ",";
  50. /*if (!is_numeric($element)) {
  51. $str . = "'$element':";
  52. }*/
  53. if ( is_string ( $value )) {
  54. $str .= "'$value'"
  55. } else if ( is_bool ( $ value )) {
  56. $str .= ($value ) ? "true" : "false";
  57. } else if (is_array($value)) {
  58. if(count($value) == 1 && is_string($value[0])) {
  59. $ str .= $value[0];
  60. } else {
  61. $str.="[";
  62. $str.=$this->JSRender($value, false) .= "]"; ;
  63. }
  64. } else {
  65. if(empty($value)){
  66. $str .= "''";
  67. }else{
  68. $ str .= $value ;
  69. }
  70. }
  71. }
  72. return $str ;
  73. }
  74. public function render() {
  75. return $this-> getJavascript ();}
  76. public function show() {
  77. echo $this->getJavascript();
  78. }
  79. public function __toString() {
  80. return $this->getJavascript( ) ;
  81. }
  82. }
    1. /**
    2. * +--------------------------------------------- ----------- --------------------------
    3. * | PHPExtJs
    4. * +-- -------------------------------------------------- ---- --------------------------
    5. * | @License: ( http://www.apache.org/licenses /LICENSE-2.0 )
    6. * +------------------------ ---------------- ------------------------------------------
    7. * | @作者: wb
    8. * +------------------------------------- ----------- --------------------------------------- -----------
    9. */
    10. include_once "ExtBase.class.php";
    11. include_once "ExtObject.class.php" ;
    12. include_once "ExtFunction.class.php";
    13. include_once "ExtPage.class.php";
    14. 類別視窗擴展ExtBase{
    15. private $vpbody = null; public $items = array();
    16. /**
    17. * 依$config配置viewport
    18. */
    19. public function __construct($config=array()) {
    20. if(!empty ($config) && is_array($config)){
    21. foreach ($config as $k => $v){
    22. if($k == 'items') continue;
    23. $this- > setProperty($k,$v);
    24. }
    25. if( !empty($config['items'])){
    26. if( is_array($config['items']) ){
    27. foreach ($config['items'] as $v){
    28. $this->addItems($v);
    29. }
    30. }else{
    31. $this->addItems ($v) ;
    32. }
    33. }
    34. }
    35. }
    36. /**
    37. * 依照屬性值$value設定$property屬性
    38. *
    39. * @param String $property 屬性名稱
    40. * @param Mixed $value 屬性值
    41. */
    42. public function setProperty($property,$value){
    43. if (!empty( $property) && !empty($value)) $this->property[$property] = $value;
    44. }
    45. /**
    46. * 新增Viewport的顯示物件
    47. *
    48. * @param ExtObject $object
    49. */
    50. public function addItems($物件){
    51. if(!empty($object)){
    52. $this->items[] = $object;
    53. }
    54. }
    55. /**
    56. * 初始化viewport
    57. */
    58. private function init(){
    59. $obj = new ExtObject("Ext.Viewport",array());
    60. $obj->setProperties($this->property );
    61. $obj->setProperties($this->property );
    62. $obj- >setProperty("items",$this->items);
    63. $this->vpbody = $obj;
    64. }
    65. /**
    66. * 取得viewport的JS
    67. *
    68. * @return String
    69. */
    70. public function getJavascript (){
    71. $this->init();
    72. return $this->vpbody->render("vport");
    73. }
    74. /**
    75. *
    76. */
    77. public function render(){
    78. $js = $this->getJavascript ();
    79. $default = isset ( $_COOKIE ['外部主題'] ) ? $_COOKIE ['exttheme'] : $_SESSION ['SYS_THEM'];
    80. if (!empty ( $default ))
    81. $this->setExtCss ( $default ); //設定EXTJS的顯示樣式
    82. //建立extjs的頁面並設定頁面的基本ext執行環境
    83. $page = new ExtPage ( );
    84. $page->extbase = $this->getExtBaseCode(); //設定extBase
    85. $page->extjs .= "Ext.onReady(function(){";
    86. $page->extjs .= $js;
    87. $ page- >extjs .= "});";
    88. //$page->body = "
      ";
    89. $ page->render ();
    90. }
    91. public function show(){
    92. $this->render();
    93. }
    94. public function __toString( ){
    95. return $this- >getJavascript();
    96. }
    97. }
    98. ?>
    複製程式碼
    1. /**
    2. * +--------------------------------------------- ----------- --------------------------
    3. * | PHPExtJs
    4. * +-- -------------------------------------------------- ---- --------------------------
    5. * | @License: ( http://www.apache.org/licenses /LICENSE-2.0 )
    6. * +------------------------ ---------------- ------------------------------------------
    7. * | @作者: wb
    8. * +------------------------------------- ----------- --------------------------------------- -----------
    9. */
    10. include_once "ExtBase.class.php";
    11. include_once "ExtObject.class.php" ;
    12. include_once "ExtFunction.class.php";
    13. include_once "ExtPage.class.php";
    14. class Window extends ExtBase {
    15. private $winname = '' private $winitems = null;
    16. private $winbutton = null;
    17. private $winbbar = null;
    18. private $property = array ();
    19. private $property = array ();
    20. *
    21. * 產生Extjs的視窗
    22. * @param String $name 視窗名稱
    23. * @param Array $config 設定陣列
    24. */
    25. public function __construct($name,$config) {
    26. //parent::__construct ();
    27. if(!empty($name)){
    28. $ this ->winname = $name;
    29. }
    30. if (!empty ( $config ) && is_array ( $config )) {
    31. foreach ( $config as $k => $v ) {
    32. if ($k == 'items' || $k == 'bbar' || $k == 'buttons')
    33. 繼續;
    34. $this->setProperty ( $k, $v );
    35. }
    36. if (!empty ( $config ['items'] )) {
    37. if (is_array ( $config ['items'] )) {
    38. foreach ( $config ['items'] as $v ) {
    39. $this->addItems ( $v );
    40. }
    41. } else {
    42. $this->addItems ( $v );
    43. }
    44. }
    45. if (!空( $config ['bbar'] )) {
    46. if (is_array ( $config ['bbar'] )) {
    47. foreach ( $config ['bbar'] as $v ) {
    48. $ this->addBbar ( $v );
    49. }
    50. } else {
    51. $this->addBbar ( $v );
    52. }
    53. }
    54. if (!空( $config ['buttons'] )) {
    55. if (is_array ( $config ['buttons'] )) {
    56. foreach ( $config ['buttons'] as $v ) {
    57. $ this->addBbar ( $v );
    58. }
    59. } else {
    60. $this->addBbar ( $v );
    61. }
    62. }
    63. }
    64. }
    65. }
    66. }
    67. }
    68. }
    69. }
    70. }
    71. }
    72. }
    73. }
    74. }
    75. }
    76. }
    77. }
    78. }
    79. }
    80. }
    81. /**
    82. * 依照屬性值$value設定$property屬性
    83. *
    84. * @param String $property 屬性名稱
    85. * @param Mixed $value 屬性值
    86. */
    87. public function setProperty($property, $value) {
    88. if (!empty ( $property ) && !empty ( $value ))
    89. $this ->property [$property] = $value;
    90. }
    91. /**
    92. * 新增Windows的顯示物件
    93. *
    94. * @param ExtObject $object
    95. */
    96. public function addItems($object) {
    97. if (!empty ( $ object )) {
    98. $this->winitems [] = $object;
    99. }
    100. }
    101. /**
    102. * 新增Windows的工具
    103. *
    104. * @param Mixed $object
    105. */
    106. public function addBbar($object) {
    107. if (!empty ( $object )) {
    108. $this->winbbar [] = $object;
    109. }
    110. }
    111. /**
    112. * 新增Windows的按鈕
    113. *
    114. * @param Mixed $object
    115. */
    116. public function addButton( $object) {
    117. if (!empty ( $object )) {
    118. $this->winbutton [] = $object;
    119. }
    120. }
    121. 私有函數{
    122. $obj = new ExtObject ( "Ext.Window", array () );
    123. $obj->setProperties ( $this->property );
    124. if (!空( $this->winbbar ) ))
    125. $obj->setProperty ( "bbar", $this->winbbar );
    126. if (!empty ( $this->winitems ))
    127. $obj->setProperty ( "items" , $this->winitems );
    128. if (!empty ( $this->winbutton ))
    129. $obj->setProperty ( "buttons", $this->winbutton );
    130. $ this ->winbody = $obj;
    131. }
    132. /**
    133. * 取得windows物件的JS
    134. *
    135. * @param String $winName
    136. */
    137. public function getJavascript() {
    138. $this->init ();
    139. if (!empty ( $this->winname ))
    140. return $this->winbody->render ( $this->winname ) 。 "{$this->winname}.show();";
    141. else
    142. return $this->winbody->render ();
    143. }
    144. public function render ($winName = '') {
    145. $js = $this->getJavascript ( $winName );
    146. //建立extjs的頁面並設定頁面的基本ext環境執行
    147. $page = new ExtPage ();
    148. $page->extbase = $this->getExtBaseCode (); //設定extBase
    149. $page->extjs .= "Ext.onReady(function(){"; $page->extjs .= $js; $ page- >extjs .= "});"; $page->render (); } public function show($winName = 'win1') { $ this->render ( $winName ); } public function __toString() { return $this->getJavascript (); } }
    150. ?>
    複製程式碼
    1. vendor("com.qldx.ext.*");
    2. class FormWin 擴充 Form {
    3. class FormWin 擴充 Form {
    4. /**
    5. * 窗體載入初始資料的物件
    6. * @var ExtObject
    7. */
    8. public $formLoad = null;
    9. /**
    10. * 窗體讀取資料的物件
    11. * @var ExtObject
    12. */
    13. public $formreader = null;
    14. /**
    15. * 載入資料時傳遞的參數
    16. * @var Mixed
    17. */
    18. public $formLoadParam = null;
    19. /**
    20. * 視窗物件
    21. * @var ExtObject
    22. */
    23. public $windolg = null;
    24. /**
    25. * 表單欄位集
    26. * @var Array
    27. */
    28. public $fieldset = array() ;
    29. /**
    30. * 初始化窗體物件的程式碼
    31. * @var String
    32. */
    33. public $initcorde = '';
    34. /**
    35. * 視窗不含按鈕 預設為false意為含有按鈕
    36. * @var Bloon
    37. */
    38. public $noButton = false;
    39. /* *
    40. * 建構窗體
    41. * @param String $formName 窗體名稱
    42. * @param String $ModelName 窗體關聯資料表模型名稱
    43. * @param Mixed $dataId 窗體關聯資料的ID
    44. * @param Array $Properties 窗體屬性陣列
    45. */
    46. public function __construct($formName = '', $ModelName = "", $dataId = "", $Properties = array()) {
    47. parent::__construct($formName, $ ModelName, $dataId, $Properties);
    48. $this->formbody->setProperty("labelWidth", 80);
    49. $this->formbody->setProperty("defaults", array ("{xtype: 'textfield',anchor:'100%'}"));
    50. $this->windolg = new ExtObject("FormWin",
    51. array(
    52. 'id' => ; $this->formName ,
    53. 'name' => $this->formName,
    54. 'dataID' =>; $this->dataId,
    55. '標題' =>; $this->formbody->title,
    56. '可折疊' =>; true,
    57. '可最大化' =>正確,
    58. '佈局' => '適合',
    59. '普通'=> true,
    60. 'bodyStyle ' =>; '填滿:5px;',
    61. '按鈕對齊' =>; 'center',
    62. "msk" =>; array("new Ext.LoadMask(Ext.getBody(), {msg : '正載入數據,請稍等...'})"),
    63. "createFormPanel" =>; null,
    64. "initComponent" =>; null
    65. )
    66. );
    67. $this->initcorde = new ExtFunction(NULL, "
    68. this.keys={
    69. key: Ext.EventObject.ENTER,<:> fn .save,
    70. 範圍: this
    71. };
    72. FormWin.superclass.initComponent.call(this);
    73. this.fp=this.createFormPanel();
    74. this.add(this . fp);
    75. if(!this.dataID && this.loadParam.id){
    76. this.dataID = this.loadParam.id
    77. }
    78. ");
    79. }
    80. /**
    81. * 設定窗體預設的初始化代碼
    82. * @param Mixed $code 代碼字串或ExtObject物件
    83. */
    84. public function setFormInitCode($code) {
    85. $this->initcorde->SetCode($code);
    86. }
    87. /**
    88. * 設定窗體載入事件注意:當$obj為空時加入預設的Loader 如果要傳第其它參數,必須
    89. * 先透過setFormLoaderParam方法設定載入時的其他物件
    90. * @param ExtObject $obj form的Loader物件
    91. */
    92. public function setFormLoader($obj = null) {
    93. $tobj = null;
    94. $param = null;
    95. if ($this->dataId) {
    96. $ param = new ExtObject(null, array('id' => $this->dataId));
    97. } else {
    98. $param = new ExtObject(null, array('id') => array(' this.dataID')));
    99. }
    100. if (!empty($obj) && is_object($obj)) {
    101. if (!isset($obj) -> 參數)| |空($obj->param)) {
    102. $this->setProperty("loadParam", $obj->param);
    103. $this->del('param');
    104. } else { //如果載入的物件明確param則併入預先設定的loadParam
    105. $this->setProperty("loadParam", $param);
    106. } $obj->; param = array("this.loadParam"); $tobj = $obj; }else {
    107. $this->setProperty("loadParam", $param);
    108. $tobj = new ExtObject(null, array(
    109. "url" => __URL__ . "/getFormWinData",
    110. "url" => __URL__ . "/getFormWinData",
    111. "params" => array('this.loadParam'),
    112. "success" => new ExtFunction(Null, "
    113. this.msk.hide();
    114. "),
    115. "範圍" => array('this')
    116. ));
    117. }
    118. $this->formLoad = $tobj;
    119. }
    120. /**
    121. * 設定窗體的資料載入Loader物件的屬性
    122. * @param String $attrib
    123. * @param Mixed $value
    124. */
    125. public function setFormLoaderProperty($attrib, $value) {
    126. $this->formLoad->setProperty($attrib, $value);
    127. }
    128. /**
    129. * 設定額外的窗體載入物件的參數
    130. * @param String $param 參數名稱
    131. * @param Mixed $value 參數值
    132. */
    133. public function setFormLoaderParam($param, $value) {
    134. $this->formLoadParam->setProperty($param, $value);
    135. }
    136. /**
    137. * 設定視窗容器的屬性
    138. * @param String $attrib
    139. * @param Mixed $value
    140. */
    141. public function setWindowsProperty($attrib, $value) {
    142. $this->windolg->setProperty($attrib, $value);
    143. }
    144. /**
    145. * 設定窗體讀取資料標識form reader
    146. */
    147. private function setFormReader() {
    148. $this->formreader = new ExtObject(
    149. 'Ext.data.JsonReader',
    150. array(
    151. new Ext,
    152. null,
    153. array("root" =>; "data")
    154. ),
    155. $this->fieldset
    156. )
    157. );
    158. }
    159. 函數setFormInt() {
    160. $twidth = 0 ;
    161. $tmpwidth = 16;
    162. $tmpheight = 40;
    163. // 表單名稱的讀取資料的標記欄位清單
    164. foreach ($this->formFields as $ n => $f) {
    165. $this->fieldset[] = new ExtObject(null, array('name' => $n, 'mapping' => $n ) );
    166. }
    167. //並且計算表格的高度
    168. if (empty($this->windolg->height)) {
    169. foreach ($this->formFields as $n => $ f) {
    170. if (isset($f->height) && $f->height > 0) {
    171. $tmpheight += $f->height;
    172. } else {
    173. $ tmpheight += 32;
    174. }
    175. if (isset($f->width) && $f->width > $tmpwidth) {
    176. $twidth = $f->;寬度;
    177. }
    178. }
    179. } else {
    180. $tmpheight = $this->windolg->height;
    181. $twidth = $this->windolg->width;
    182. }
    183. if (empty($tmpheight)) {
    184. $tmpheight = 200;
    185. } elseif ($tmpheight > )第750章) || $tmpwidth == 16) {
    186. $tmpwidth = 340;
    187. }
    188. $this->windolg->setProperty("width", $tmpwidth);
    189. $this->windolg->setProperty ("height", $tmpeight);
    190. $this->windolg->setProperty("minWidth", $tmpwidth);
    191. $this->windolg-> setProperty("minHeight", $tmpeight);
    192. }
    193. /**
    194. * 新增窗體的預設新增按鈕
    195. * @param String $name 預設為:save
    196. * @param String $title 預設為:儲存
    197. * @param ExtFunction $hander 預設的事件回應對象
    198. */
    199. public function addSaveButton($name = '儲存', $title='儲存', $hander=null) {
    200. if (empty ($hander)) {
    201. $hander = new ExtFunction(null, "
    202. if(this.fp.form.isValid()){
    203. var turl = '" . __URL__ . "/saveFormWinData';
    204. if(this.dataID){
    205. turl += '/id/'+ this.dataID;
    206. }
    207. var fw = this;
    208. this.fp.form.submit({
    209. waitTitle:'請稍候',
    210. waitMsg : '正在處理請求...',
    211. url : turl,
    212. params: this.loadParam,
    213. success : function(form, action){
    214. fw.close();
    215. if(form.rGrid){
    216. if(form.rGrid .root){
    217. form.rGrid.getLoader().load(form.rGrid.root);
    218. }else{
    219. form.rGrid.getLoader().load();
    220. }
    221. }
    222. },
    223. failure : function() {
    224. fw.close;
    225. Ext.Msg.alert('系統錯誤','伺服器出現錯誤請稍後再試!') ;
    226. }
    227. });
    228. }
    229. ");
    230. }
    231. $this->addButton($name, $title);
    232. $this->setButtonAttrib( $name, 'handler', $hander);
    233. }
    234. /**
    235. * 新增預設取消按鈕
    236. * @param String $name
    237. * @param String $title
    238. * @param ExtFunction $hander
    239. */
    240. public function addCancelButton($name = 'cancle', $title='取消', $hander=null) {
    241. if (empty($hander)) {
    242. $hander = new ExtFunction(null, "
    243. this.close();
    244. ");
    245. }
    246. $this->addButton($name, $title);
    247. $this->setButtonAttrib($name, 'handler', $hander);
    248. }
    249. /**
    250. * 根據model物件名稱設定FormWin的資料model
    251. *
    252. * @param String $modelName model物件名稱
    253. * @param Mixed $id 要編輯到記錄號
    254. */
    255. public function setDataModel($modelObject, $id) {
    256. $this->setDataSource($modelObject, $id);
    257. }
    258. /**
    259. * 根據model物件名稱設定FormWin的資料model
    260. * @param String $modelName model物件名稱
    261. * /
    262. public function setDataModelByName($modelName) {
    263. if (!empty($modelName)) {
    264. $model = D($modelName);
    265. $this->setDataModel($model);
    266. }
    267. }
    268. /**
    269. * 本方法傳回此物件的JS字串
    270. * @return String 本物件的JS字串
    271. */
    272. public function getJavascript() {
    273. $this->initForm();
    274. $this->setFormIntInt ();
    275. $this->setFormReader();
    276. $this->setFormLoader();
    277. //併入窗體的資料載入物件
    278. $this->setFormInitCode("
    279. this.fp.load(" . $this->formLoad->render() . ");
    280. ");
    281. //設定窗體基本屬性
    282. if (empty($this-> formbody->baseCls)) {
    283. $this->formbody->setproperty('baseCls', 'x-plain');
    284. }
    285. if (empty($this->formbody->reader) ) {
    286. $this->formbody->setProperty("reader", $this->formreader);
    287. }
    288. $this->formbody->setProperty("items", $this->getElementArray ());
    289. //建立視窗
    290. $this->windolg->setProperty(
    291. "createFormPanel",
    292. new ExtFunction(null,
    293. array("return" => $this ->formbody->render())
    294. )
    295. );
    296. //新增按鈕
    297. if (!$this->noButton) {
    298. if (!empty($this-> formButtons) && is_array($this->formButtons)) {
    299. foreach ($this->formButtons as $k => $v) {
    300. $this->initcorde->SetCode("this.addButton(' " . $v->text . "',this." . $k . ",this);");
    301. $this->windolg->setProperty($k, $v->handler);
    302. }
    303. } else {
    304. $this->initcorde->SetCode("
    305. this.addButton('保存',this.save,this);
    306. this.addButton('取消', function(){this.close();},this);
    307. ");
    308. }
    309. }
    310. $this->windolg->setProperty("initComponent", $this->initcorde );
    311. $this->windolg->setExtendsClass("Ext.Window");
    312. return $this->formExtendJs . $this->windolg->render();
    313. }
    314. }
    315. ?>
    複製程式碼


陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
PHP:服務器端腳本語言的簡介PHP:服務器端腳本語言的簡介Apr 16, 2025 am 12:18 AM

PHP是一種服務器端腳本語言,用於動態網頁開發和服務器端應用程序。 1.PHP是一種解釋型語言,無需編譯,適合快速開發。 2.PHP代碼嵌入HTML中,易於網頁開發。 3.PHP處理服務器端邏輯,生成HTML輸出,支持用戶交互和數據處理。 4.PHP可與數據庫交互,處理表單提交,執行服務器端任務。

PHP和網絡:探索其長期影響PHP和網絡:探索其長期影響Apr 16, 2025 am 12:17 AM

PHP在過去幾十年中塑造了網絡,並將繼續在Web開發中扮演重要角色。 1)PHP起源於1994年,因其易用性和與MySQL的無縫集成成為開發者首選。 2)其核心功能包括生成動態內容和與數據庫的集成,使得網站能夠實時更新和個性化展示。 3)PHP的廣泛應用和生態系統推動了其長期影響,但也面臨版本更新和安全性挑戰。 4)近年來的性能改進,如PHP7的發布,使其能與現代語言競爭。 5)未來,PHP需應對容器化、微服務等新挑戰,但其靈活性和活躍社區使其具備適應能力。

為什麼要使用PHP?解釋的優點和好處為什麼要使用PHP?解釋的優點和好處Apr 16, 2025 am 12:16 AM

PHP的核心優勢包括易於學習、強大的web開發支持、豐富的庫和框架、高性能和可擴展性、跨平台兼容性以及成本效益高。 1)易於學習和使用,適合初學者;2)與web服務器集成好,支持多種數據庫;3)擁有如Laravel等強大框架;4)通過優化可實現高性能;5)支持多種操作系統;6)開源,降低開發成本。

揭穿神話:PHP真的是一種死語嗎?揭穿神話:PHP真的是一種死語嗎?Apr 16, 2025 am 12:15 AM

PHP沒有死。 1)PHP社區積極解決性能和安全問題,PHP7.x提升了性能。 2)PHP適合現代Web開發,廣泛用於大型網站。 3)PHP易學且服務器表現出色,但類型系統不如靜態語言嚴格。 4)PHP在內容管理和電商領域仍重要,生態系統不斷進化。 5)通過OPcache和APC等優化性能,使用OOP和設計模式提升代碼質量。

PHP與Python辯論:哪個更好?PHP與Python辯論:哪個更好?Apr 16, 2025 am 12:03 AM

PHP和Python各有優劣,選擇取決於項目需求。 1)PHP適合Web開發,易學,社區資源豐富,但語法不夠現代,性能和安全性需注意。 2)Python適用於數據科學和機器學習,語法簡潔,易學,但執行速度和內存管理有瓶頸。

PHP的目的:構建動態網站PHP的目的:構建動態網站Apr 15, 2025 am 12:18 AM

PHP用於構建動態網站,其核心功能包括:1.生成動態內容,通過與數據庫對接實時生成網頁;2.處理用戶交互和表單提交,驗證輸入並響應操作;3.管理會話和用戶認證,提供個性化體驗;4.優化性能和遵循最佳實踐,提升網站效率和安全性。

PHP:處理數據庫和服務器端邏輯PHP:處理數據庫和服務器端邏輯Apr 15, 2025 am 12:15 AM

PHP在數據庫操作和服務器端邏輯處理中使用MySQLi和PDO擴展進行數據庫交互,並通過會話管理等功能處理服務器端邏輯。 1)使用MySQLi或PDO連接數據庫,執行SQL查詢。 2)通過會話管理等功能處理HTTP請求和用戶狀態。 3)使用事務確保數據庫操作的原子性。 4)防止SQL注入,使用異常處理和關閉連接來調試。 5)通過索引和緩存優化性能,編寫可讀性高的代碼並進行錯誤處理。

您如何防止PHP中的SQL注入? (準備的陳述,PDO)您如何防止PHP中的SQL注入? (準備的陳述,PDO)Apr 15, 2025 am 12:15 AM

在PHP中使用預處理語句和PDO可以有效防範SQL注入攻擊。 1)使用PDO連接數據庫並設置錯誤模式。 2)通過prepare方法創建預處理語句,使用佔位符和execute方法傳遞數據。 3)處理查詢結果並確保代碼的安全性和性能。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
4 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
4 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
4 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它們
4 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),