【GIFDecoder】GIFDecoder的排錯以及修改另附完整程式碼和demo
前言
好久沒有寫技術類的部落格了,今天有些小的收穫,記錄下來,留作備份
Gif圖片的處理
由於業務需求,需要對gif動圖的第一幀進行擷取,然後我就搜尋,發現了GIFDecoder這樣的一個類,是做gif圖片的處理的,怎奈國內人部落格環境還是那麼差,各種網站部落格到處抄抄抄,沒有一個完整的內容,經過多個站的資料整理,終於能用了。
出現了異常
在執行demo的時候,遇到了顯示錯誤的問題
Notice: Undefined offset: 4 in /Applications/XAMPP/xamppfiles/htdocs/giftest/gifdecoder.class.php on line 83
檢視原始碼發現83行是這樣的
function GIFReadExtensions() {
GIFDecoder::GIFGetByte(1);
if ($this->GIF_buffer [0] == 0xff) {
for (;;) {
GIFDecoder::GIFGetByte(1);
if (( $u = $this->GIF_buffer [0] ) == 0x00) {
break ;
}
GIFDecoder::GIFGetByte($u);
if ($u == 0x03) {
$this->GIF_anloop = ( $this->GIF_buffer [1] | $this->GIF_buffer [2] << 8 );
}
}
} else {
for (;;) {
GIFDecoder::GIFGetByte(1);
if (( $u = $this->GIF_buffer [0] ) == 0x00) {
break;
}
GIFDecoder::GIFGetByte($u);
if ($u == 0x04) {
if ($this->GIF_buffer [4] & 0x80) { //這裡是第83行
$this->GIF_dispos [] = ( $this->GIF_buffer [0] >> 2 ) - 1;
} else {
$this->GIF_dispos [] = ( $this->GIF_buffer [0] >> 2 ) - 0;
}
$this->GIF_delays [] = ( $this->GIF_buffer [1] | $this->GIF_buffer [2] << 8 );
if ($this->GIF_buffer [3]) {
$this->GIF_TransparentI = $this->GIF_buffer [3];
}
}
}
}
}
原因
經過搜尋引擎的努力,我得到的比較正規的解釋是
offset:接下去的數字是出錯的陣列下標,一般是超出了陣列的取值範圍,如定義了陣列
A[]有10個元數,如果出現了 A[10]就會出現錯誤(Notice: Undefined offset: 10 ….),因為陣列的下標是從0開始的,所以這個陣列的下標就只能是0~9.
所以,原因就是
陣列找不到下標為4的元素
解決方案
我們需要判斷下標是不是存在
if (isset($this->GIF_buffer [4]) & 0x80) {
醬紫就搞定啦,啦啦啦~
原始碼
<?php
/**
* GIFDecoder <br/>
*
* 日期: 2015年05月21日 <br/>
* 原作者: 不詳 <br/>
* 修改: CalvinLee <br/>
*
*
* <code>
* require_once("gifdecoder.class.php");
*
* $FIC = "test.gif";
* //獲取gif的第一幀進行儲存
* if (file_exists($FIC)) {
* $GIF_frame = fread(fopen($FIC, 'rb'), filesize($FIC));
* $decoder = new GIFDecoder($GIF_frame);
* $frames = $decoder->GIFGetFrames();
* $i = 0;
* $fname = rand(1000, 9999). $FIC . "_0$i.png";
* $hfic = fopen("" . $fname, "wb");
* fwrite($hfic, $frames [$i]);
* fclose($hfic);
* }
* </code>
*
*
* @copyright (c) 2015, Calvin Lee
* @author Calvin Lee <[email protected]>
*/
Class GIFDecoder {
public $GIF_TransparentR = -1;
public $GIF_TransparentG = -1;
public $GIF_TransparentB = -1;
public $GIF_TransparentI = 0;
public $GIF_buffer = array();
public $GIF_arrays = array();
public $GIF_delays = array();
public $GIF_dispos = array();
public $GIF_stream = "";
public $GIF_string = "";
public $GIF_bfseek = 0;
public $GIF_anloop = 0;
public $GIF_screen = array();
public $GIF_global = array();
public $GIF_sorted;
public $GIF_colorS;
public $GIF_colorC;
public $GIF_colorF;
function GIFDecoder($GIF_pointer) {
$this->GIF_stream = $GIF_pointer;
GIFDecoder::GIFGetByte(6);
GIFDecoder::GIFGetByte(7);
$this->GIF_screen = $this->GIF_buffer;
$this->GIF_colorF = $this->GIF_buffer [4] & 0x80 ? 1 : 0;
$this->GIF_sorted = $this->GIF_buffer [4] & 0x08 ? 1 : 0;
$this->GIF_colorC = $this->GIF_buffer [4] & 0x07;
$this->GIF_colorS = 2 << $this->GIF_colorC;
if ($this->GIF_colorF == 1) {
GIFDecoder::GIFGetByte(3 * $this->GIF_colorS);
$this->GIF_global = $this->GIF_buffer;
}
for ($cycle = 1; $cycle;) {
if (GIFDecoder::GIFGetByte(1)) {
switch ($this->GIF_buffer [0]) {
case 0x21:
GIFDecoder::GIFReadExtensions();
break;
case 0x2C:
GIFDecoder::GIFReadDescriptor();
break;
case 0x3B:
$cycle = 0;
break;
}
} else {
$cycle = 0;
}
}
}
function GIFReadExtensions() {
GIFDecoder::GIFGetByte(1);
if ($this->GIF_buffer [0] == 0xff) {
for (;;) {
GIFDecoder::GIFGetByte(1);
if (( $u = $this->GIF_buffer [0] ) == 0x00) {
break;
}
GIFDecoder::GIFGetByte($u);
if ($u == 0x03) {
$this->GIF_anloop = ( $this->GIF_buffer [1] | $this->GIF_buffer [2] << 8 );
}
}
} else {
for (;;) {
GIFDecoder::GIFGetByte(1);
if (( $u = $this->GIF_buffer [0] ) == 0x00) {
break;
}
GIFDecoder::GIFGetByte($u);
if ($u == 0x04) {
if (isset($this->GIF_buffer [4]) & 0x80) {
$this->GIF_dispos [] = ( $this->GIF_buffer [0] >> 2 ) - 1;
} else {
$this->GIF_dispos [] = ( $this->GIF_buffer [0] >> 2 ) - 0;
}
$this->GIF_delays [] = ( $this->GIF_buffer [1] | $this->GIF_buffer [2] << 8 );
if ($this->GIF_buffer [3]) {
$this->GIF_TransparentI = $this->GIF_buffer [3];
}
}
}
}
}
function GIFReadDescriptor() {
$GIF_screen = Array();
GIFDecoder::GIFGetByte(9);
$GIF_screen = $this->GIF_buffer;
$GIF_colorF = $this->GIF_buffer [8] & 0x80 ? 1 : 0;
if ($GIF_colorF) {
$GIF_code = $this->GIF_buffer [8] & 0x07;
$GIF_sort = $this->GIF_buffer [8] & 0x20 ? 1 : 0;
} else {
$GIF_code = $this->GIF_colorC;
$GIF_sort = $this->GIF_sorted;
}
$GIF_size = 2 << $GIF_code;
$this->GIF_screen [4] &= 0x70;
$this->GIF_screen [4] |= 0x80;
$this->GIF_screen [4] |= $GIF_code;
if ($GIF_sort) {
$this->GIF_screen [4] |= 0x08;
}
//GIF Data Begin
if ($this->GIF_TransparentI) {
$this->GIF_string = "GIF89a";
} else {
$this->GIF_string = "GIF87a";
}
GIFDecoder::GIFPutByte($this->GIF_screen);
if ($GIF_colorF == 1) {
GIFDecoder::GIFGetByte(3 * $GIF_size);
if ($this->GIF_TransparentI) {
$this->GIF_TransparentR = $this->GIF_buffer [3 * $this->GIF_TransparentI + 0];
$this->GIF_TransparentG = $this->GIF_buffer [3 * $this->GIF_TransparentI + 1];
$this->GIF_TransparentB = $this->GIF_buffer [3 * $this->GIF_TransparentI + 2];
}
GIFDecoder::GIFPutByte($this->GIF_buffer);
} else {
if ($this->GIF_TransparentI) {
$this->GIF_TransparentR = $this->GIF_global [3 * $this->GIF_TransparentI + 0];
$this->GIF_TransparentG = $this->GIF_global [3 * $this->GIF_TransparentI + 1];
$this->GIF_TransparentB = $this->GIF_global [3 * $this->GIF_TransparentI + 2];
}
GIFDecoder::GIFPutByte($this->GIF_global);
}
if ($this->GIF_TransparentI) {
$this->GIF_string .= "!\xF9\x04\x1\x0\x0" . chr($this->GIF_TransparentI) . "\x0";
}
$this->GIF_string .= chr(0x2C);
$GIF_screen [8] &= 0x40;
GIFDecoder::GIFPutByte($GIF_screen);
GIFDecoder::GIFGetByte(1);
GIFDecoder::GIFPutByte($this->GIF_buffer);
for (;;) {
GIFDecoder::GIFGetByte(1);
GIFDecoder::GIFPutByte($this->GIF_buffer);
if (( $u = $this->GIF_buffer [0] ) == 0x00) {
break;
}
GIFDecoder::GIFGetByte($u);
GIFDecoder::GIFPutByte($this->GIF_buffer);
}
$this->GIF_string .= chr(0x3B);
//GIF Data End
$gif_array = &$this->GIF_arrays;
$gif_array[] = $this->GIF_string;
}
function GIFGetByte($len) {
$this->GIF_buffer = Array();
for ($i = 0; $i < $len; $i++) {
if ($this->GIF_bfseek > strlen($this->GIF_stream)) {
return 0;
}
$this->GIF_buffer[] = ord($this->GIF_stream { $this->GIF_bfseek++});
}
return 1;
}
function GIFPutByte($bytes) {
foreach ($bytes as $byte) {
$this->GIF_string .= chr($byte);
}
}
function GIFGetFrames() {
return ( $this->GIF_arrays );
}
function GIFGetDelays() {
return ( $this->GIF_delays );
}
function GIFGetLoop() {
return ( $this->GIF_anloop );
}
function GIFGetDisposal() {
return ( $this->GIF_dispos );
}
function GIFGetTransparentR() {
return ( $this->GIF_TransparentR );
}
function GIFGetTransparentG() {
return ( $this->GIF_TransparentG );
}
function GIFGetTransparentB() {
return ( $this->GIF_TransparentB );
}
}
?>
後記
- 小的知識積累最後會有質變
- 善於總結永遠沒有壞處
- 一個功能寫三遍就會變得不一樣,如果還一樣的話那就是自己的問題了
後後記
後來發現這個類在Yii2中還是不能使用,識別不出gif裡面的圖片,所以,我又去github上找到了這個類的2.0版
下面是用的原始碼,已經加上了namespace和註釋
<?php
namespace common\components\helper;
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFDecoder Version 2.0 by László Zsidi
:: Optimized version by xurei
::
:: Created at 2007. 02. 01. '07.47.AM'
::
:: Updated at 2009. 06. 23. '06.00.AM'
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
*
*
*
* <code>
* require_once("gifdecoder.class.php");
*
* $FIC = "test.gif";
* //獲取gif的第一幀進行儲存
* if (file_exists($FIC)) {
* $GIF_frame = fread(fopen($FIC, 'rb'), filesize($FIC));
* $decoder = new GIFDecoder($GIF_frame);
* $frames = $decoder->GIFGetFrames();
* $i = 0;
* $fname = rand(1000, 9999). $FIC . "_0$i.png";
* $hfic = fopen("" . $fname, "wb");
* fwrite($hfic, $frames [$i]);
* fclose($hfic);
* }
* </code>
*
*
*
*
*/
use SplFixedArray;
class GIFDecoder {
var $GIF_TransparentR = -1;
var $GIF_TransparentG = -1;
var $GIF_TransparentB = -1;
var $GIF_TransparentI = 0;
var $GIF_buffer = null;
var $GIF_arrays = Array ( );
var $GIF_delays = Array ( );
var $GIF_dispos = Array ( );
var $GIF_stream = "";
var $GIF_string = "";
var $GIF_bfseek = 0;
var $GIF_anloop = 0;
//xurei - frames metadata
var $GIF_frames_meta = Array();
var $GIF_screen = Array ( );
var $GIF_global = Array ( ); //global color map
var $GIF_sorted;
var $GIF_colorS; //
var $GIF_colorC; //Size of global color table
var $GIF_colorF; //if 1, global color table follows image descriptor
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFDecoder ( $GIF_pointer )
::
*/
function __construct ( $GIF_pointer ) {
$this->GIF_stream = $GIF_pointer;
GIFDecoder::GIFGetByte ( 6 );
GIFDecoder::GIFGetByte ( 7 );
$this->GIF_screen = $this->GIF_buffer;
$this->GIF_colorF = $this->GIF_buffer [ 4 ] & 0x80 ? 1 : 0;
$this->GIF_sorted = $this->GIF_buffer [ 4 ] & 0x08 ? 1 : 0;
$this->GIF_colorC = $this->GIF_buffer [ 4 ] & 0x07;
$this->GIF_colorS = 2 << $this->GIF_colorC;
if ( $this->GIF_colorF == 1 ) {
GIFDecoder::GIFGetByte ( 3 * $this->GIF_colorS );
$this->GIF_global = $this->GIF_buffer;
}
for ( $cycle = 1; $cycle; ) {
if ( GIFDecoder::GIFGetByte ( 1 ) ) {
switch ( $this->GIF_buffer [ 0 ] ) {
case 0x21:
GIFDecoder::GIFReadExtensions ( );
break;
case 0x2C:
GIFDecoder::GIFReadDescriptor ( );
break;
case 0x3B:
$cycle = 0;
break;
}
}
else {
$cycle = 0;
}
}
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFReadExtension ( )
::
*/
function GIFReadExtensions ( ) {
GIFDecoder::GIFGetByte ( 1 );
if ( $this->GIF_buffer [ 0 ] == 0xff ) {
for ( ; ; ) {
GIFDecoder::GIFGetByte ( 1 );
if ( ( $u = $this->GIF_buffer [ 0 ] ) == 0x00 ) {
break;
}
GIFDecoder::GIFGetByte ( $u );
if ( $u == 0x03 ) {
$this->GIF_anloop = ( $this->GIF_buffer [ 1 ] | $this->GIF_buffer [ 2 ] << 8 );
}
}
}
else {
for ( ; ; ) {
GIFDecoder::GIFGetByte ( 1 );
if ( ( $u = $this->GIF_buffer [ 0 ] ) == 0x00 ) {
break;
}
GIFDecoder::GIFGetByte ( $u );
if ( $u == 0x04 ) {
$buf4 = count($this->GIF_buffer) >= 5 ? $this->GIF_buffer [ 4 ] : 0;
if ( $buf4 & 0x80 ) {
$this->GIF_dispos [ ] = ( $this->GIF_buffer [ 0 ] >> 2 ) - 1;
}
else {
$this->GIF_dispos [ ] = ( $this->GIF_buffer [ 0 ] >> 2 ) - 0;
}
$this->GIF_delays [ ] = ( $this->GIF_buffer [ 1 ] | $this->GIF_buffer [ 2 ] << 8 );
if ( $this->GIF_buffer [ 3 ] ) {
$this->GIF_TransparentI = $this->GIF_buffer [ 3 ];
}
}
}
}
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFReadDescriptor ( )
::
*/
function GIFReadDescriptor ( ) {
$GIF_screen = Array ( );
GIFDecoder::GIFGetByte ( 9 );
//xurei - metadata saving
$this->GIF_frames_meta[] = array(
'left'=>$this->GIF_buffer[0] + ($this->GIF_buffer[1] << 8),
'top'=>$this->GIF_buffer[2] + ($this->GIF_buffer[3] << 8),
'width'=>$this->GIF_buffer[4] + ($this->GIF_buffer[5] << 8),
'height'=>$this->GIF_buffer[6] + ($this->GIF_buffer[7] << 8),
);
$GIF_screen = $this->GIF_buffer;
$GIF_colorF = $this->GIF_buffer [ 8 ] & 0x80 ? 1 : 0;
if ( $GIF_colorF ) {
$GIF_code = $this->GIF_buffer [ 8 ] & 0x07;
$GIF_sort = $this->GIF_buffer [ 8 ] & 0x20 ? 1 : 0;
}
else {
$GIF_code = $this->GIF_colorC;
$GIF_sort = $this->GIF_sorted;
}
$GIF_size = 2 << $GIF_code;
$this->GIF_screen [ 4 ] &= 0x70;
$this->GIF_screen [ 4 ] |= 0x80;
$this->GIF_screen [ 4 ] |= $GIF_code;
if ( $GIF_sort ) {
$this->GIF_screen [ 4 ] |= 0x08;
}
/*
*
* GIF Data Begin
*
*/
if ( $this->GIF_TransparentI ) {
$this->GIF_string = "GIF89a";
}
else {
$this->GIF_string = "GIF87a";
}
GIFDecoder::GIFPutByte ( $this->GIF_screen );
if ( $GIF_colorF == 1 ) {
GIFDecoder::GIFGetByte ( 3 * $GIF_size );
if ( $this->GIF_TransparentI ) {
$this->GIF_TransparentR = $this->GIF_buffer [ 3 * $this->GIF_TransparentI + 0 ];
$this->GIF_TransparentG = $this->GIF_buffer [ 3 * $this->GIF_TransparentI + 1 ];
$this->GIF_TransparentB = $this->GIF_buffer [ 3 * $this->GIF_TransparentI + 2 ];
}
GIFDecoder::GIFPutByte ( $this->GIF_buffer );
}
else {
if ( $this->GIF_TransparentI ) {
$this->GIF_TransparentR = $this->GIF_global [ 3 * $this->GIF_TransparentI + 0 ];
$this->GIF_TransparentG = $this->GIF_global [ 3 * $this->GIF_TransparentI + 1 ];
$this->GIF_TransparentB = $this->GIF_global [ 3 * $this->GIF_TransparentI + 2 ];
}
GIFDecoder::GIFPutByte ( $this->GIF_global );
}
if ( $this->GIF_TransparentI ) {
$this->GIF_string .= "!\xF9\x04\x1\x0\x0". chr ( $this->GIF_TransparentI ) . "\x0";
}
$this->GIF_string .= chr ( 0x2C );
$GIF_screen [ 8 ] &= 0x40;
GIFDecoder::GIFPutByte ( $GIF_screen );
GIFDecoder::GIFGetByte ( 1 );
GIFDecoder::GIFPutByte ( $this->GIF_buffer );
for ( ; ; ) {
GIFDecoder::GIFGetByte ( 1 );
GIFDecoder::GIFPutByte ( $this->GIF_buffer );
if ( ( $u = $this->GIF_buffer [ 0 ] ) == 0x00 ) {
break;
}
/*for ($i=0; $i!=$u; ++$i)
{
$this->GIF_string .= $this->GIF_stream { $this->GIF_bfseek++ };
}*/
$this->GIF_string .= substr($this->GIF_stream, $this->GIF_bfseek, $u);
$this->GIF_bfseek += $u;
//GIFDecoder::GIFGetByte ( $u );
//GIFDecoder::GIFPutByte ( $this->GIF_buffer );
}
$this->GIF_string .= chr ( 0x3B );
/*
*
* GIF Data End
*
*/
$this->GIF_arrays [ ] = $this->GIF_string;
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetByte ( $len )
::
*/
function GIFGetByte ( $len ) {
$this->GIF_buffer = new SplFixedArray($len);
$l = strlen ( $this->GIF_stream );
for ( $i = 0; $i < $len; $i++ ) {
if ( $this->GIF_bfseek > $l ) {
$this->GIF_buffer->setSize($i);
return 0;
}
$this->GIF_buffer [$i] = ord ( $this->GIF_stream { $this->GIF_bfseek++ } );
}
return 1;
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFPutByte ( $bytes )
::
*/
function GIFPutByte ( $bytes ) {
$out = '';
foreach ( $bytes as $byte ) {
$out .= chr($byte);
}
$this->GIF_string .= $out;
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: PUBLIC FUNCTIONS
::
::
:: GIFGetFrames ( )
::
*/
function GIFGetFrames ( ) {
return ( $this->GIF_arrays );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetFramesMeta ( )
::
:: xurei - returns metadata as an array of arrays
*/
function GIFGetFramesMeta ( ) {
return ( $this->GIF_frames_meta );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetDelays ( )
::
*/
function GIFGetDelays ( ) {
return ( $this->GIF_delays );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetLoop ( )
::
*/
function GIFGetLoop ( ) {
return ( $this->GIF_anloop );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetDisposal ( )
::
*/
function GIFGetDisposal ( ) {
return ( $this->GIF_dispos );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetTransparentR ( )
::
*/
function GIFGetTransparentR ( ) {
return ( $this->GIF_TransparentR );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetTransparentG ( )
::
*/
function GIFGetTransparentG ( ) {
return ( $this->GIF_TransparentG );
}
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFGetTransparentB ( )
::
*/
function GIFGetTransparentB ( ) {
return ( $this->GIF_TransparentB );
}
}
相關推薦
【GIFDecoder】GIFDecoder的排錯以及修改另附完整程式碼和demo
前言 好久沒有寫技術類的部落格了,今天有些小的收穫,記錄下來,留作備份 Gif圖片的處理 由於業務需求,需要對gif動圖的第一幀進行擷取,然後我就搜尋,發現了GIFDecoder這樣的一個類,是做gif圖片的處理的,怎奈國內人部落格環境還是那麼差,各種
Fiddler抓包【3】_設置斷點修改
狀態 spa href enter resp ons eth 等於 disabled 1、 斷點修改Request 1.1、Request全部中斷 設置中斷:Rules---> Automatic Breakpoints--->Before Requests 取
【bzoj3052】[wc2013]糖果公園 帶修改樹上莫隊
algorithm cstring fine per sort 表示 clas %d ora 題目描述 給出一棵n個點的樹,每個點有一個點權,點權範圍為1~m。支持兩種操作:(1)修改一個點的點權 (2)對於一條路徑,求$\sum\limits_{i=1}^m\sum\l
【PHP】 解決報錯:Error: php71w-common conflicts with php-common-5.4.16-43.el7_4.x86_64
with gpo pos erro conf 問題 error col 擴展 背景: 手動安裝的PHP7 環境 問題:在安裝擴展的時候。無論輸入 php-* 來安裝任何擴展。都會報錯 Error: php71w-common conflicts with php-c
【轉載】hashCode()、equals()以及compareTo()方法的理解
進行 一個 terms 兩個 定義 == bject str rac 判斷兩個對象是否相等(是同一個對象),首先調用hashCode()方法得到各自的hashcode, 1、如果hashcode不相等,則表明兩個對象不相等。 2、如果hashcode相等,繼續調用equal
【ide】MyBatis報錯: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
align basedir schedule ima reflect oda apache ref mapper at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.j
【20180507】MySQL主從在線修改binlog格式從STATEMENT更改成ROW格式
binlog format 主從復制 ROW 需求 公司內部有幾十套基於傳統復制的MySQL主從實例,而且binlog的格式都是STATEMENT格式。在接手這些MySQL主從實例之後就有考慮過想將binlog格式更改成ROW格式。而這次則是因為我們elk上面一個第三方工具需要解析和監聽binlo
【轉載】Docker部署nginx並修改配置文件
scrip pan eve 部署 keepaliv proxy format gin 一模一樣 docker 部署個nginx docker run --name nginx-health-web-pc -d -p 6800:80 -v /usr/
【轉】JavaScript 節點操作 以及DOMDocument屬性和方法
表示 位置 clas 句柄 doc elements nta XML sele 最近發現DOMDocument對象很重要,還有XMLHTTP也很重要 註意大小寫一定不能弄錯. 屬性: 1Attributes 存儲節點的屬性列表(只讀) 2childNodes 存儲節點的子
【Android】AS報錯:Configuration on demand is not supported by the current version of the Android Gradle
轉載請註明出處,原文連結:https://blog.csdn.net/u013642500/article/details/80218299 【錯誤】 Configuration on demand is not supported by the current version o
【Android】AS報錯解決方法:Non-static method '*' cannot be referenced from a static context
轉載請註明出處,原文連結:https://blog.csdn.net/u013642500/article/details/80156306 【錯誤】 Non-static method '*' cannot be referenced from a static context
【makefile】多平臺編譯以及makefile自動化編譯總結
Date: 2018.9.30 1、前言 同一套庫程式碼往往需要在不同體系架構或系統上的機器和裝置上編譯和執行,這就需要我們熟悉不同平臺上的編譯方法以及測試方法,本文旨在講述多平臺編譯方法以及makefile自動化編譯的總結。 2、多平臺編譯之Windows平臺
【Redis】redis介紹,安裝,以及叢集搭建
1.Redis介紹 百科定義:Redis是一個開源的使用ANSI C語言編寫、支援網路、可基於記憶體亦可持久化的日誌型、Key-Value 資料庫,並提供多種語言的API。 個人理解:高效能的快取資料庫,資料存放在記憶體中,存取效能極高,有很多種應用場景,比如可以
關於在JSP中寫【if】和【else】語句報錯Syntax error on token "else", delete this token
這裡轉載一篇文章:https://blog.csdn.net/sinat_37062120/article/details/79208949 jsp中插入java程式碼 <%if (***)%> <%=***%> <%else %> <%=***%&
【前端】動態生成HTML以及a標籤不跳轉問題標記
bookmarksResults.innerHTML += '<div class="well">' + '<h3>' + name +
【轉載】批量維護(建立/修改)客戶主資料函式 SD_CUSTOMER_MAINTAIN_ALL BP自定義螢幕 資料維護
可以用來維護BP自定義螢幕的資料。 分享一下批建立客戶主資料函式:SD_CUSTOMER_MAINTAIN_ALL TABLES:T077D,ZCITY,T005S,BNKA,ADRC,KNA1. DATA: TMP_KTOKD(4) TYPE
【CSS】css 盒子模型 以及 box-sizing屬性
css 盒子模型 以及 box-sizing屬性 在標準的盒子模型下,css中 width,padding以及border的關係 關於css中的width和padding以及border的關係。 在css中,width和height指的是內容區域的寬度和高度,增加pad
【JS】FormData的使用以及提交陣列的方法
一、建立FormData的方法通常有兩種: 1、 建立一個空的formData物件 let formData = new FormData(); 2、通過HTML表單元素建立FormData物件 let formData = new FormData(someFormElemen
【Python】列表巢狀字典修改字典裡面的一個值卻把全部的值都修改了。
具體問題就是:當我往空列表裡面新增字典,需要修改其中的一個鍵的值的時候,出現把其他同類的值也修改了。 下面就是出現問題的程式碼: aliens = [] new_alien = {"color": "green"} #往字典裡新增5個字典 for num in range
【linux】linux報錯:安裝nginx時,make報錯解決方法
目錄 一、報錯情況 二、解決方法 三、openssl舊版本下載和安裝 一、報錯情況 (1)輸入命令,報錯: make (2)具體報錯: make[1]: *** [objs/src/event/ngx_event_openssl.o] 錯誤