bcompiler를 사용하여 PHP 파일을 암호화하는 호환 DC 코드 생성
사용 지침:
//함수 로드
include_once('phpCodeZip.php')
//암호화된 파일 생성(sourceDir은 암호화할 PHP 파일 디렉터리, targetDir은 암호화된 파일 디렉터리)
$encryption = new PhoCodeZip('sourceDir','targetDir');
//라인 암호화 수행
$encryption->zip()
phpCodeZip.php 소스 코드 다운로드
phpCodeZip.rar
phpCodeZip.php 소스코드 내용
코드 복사 코드는 다음과 같습니다
/*
* @license: MIT & GPL
*/
class PhpCodeZip{
//압축 및 암호화할 소스 폴더
var $sourceDir = ' .';
//압축 및 암호화가 저장되는 폴더
var $targetDir = 'tmp'
//암호화 여부
var $bcompiler = true; 빈 주석 및 줄바꿈 제거
var $strip = true;//소스 폴더 파일 경로 배열
var $sourcefilePaths = array()//대상 폴더 파일 경로 배열
var $targetPaths = array();
//압축 및 암호화 전 폴더 크기
var $sizeBeforeZip = null
//압축 및 암호화 후 폴더 크기
var; $sizeAfterZip = null
//줄바꿈 출력
var $newline = '''/**
* 생성자
*
* @param string $sourceDir 소스 폴더
* @param string $targetDir 대상 폴더
* @param boolean $bcompiler 암호화 여부
* @param boolean $strip 공백 주석 및 줄바꿈 제거 여부
* @return boolean
*/
공개 함수 PhpCodeZip($sourceDir='.',$ targetDir=' tmp' ,$bcompiler=true,$strip=true){
//초기 변수 구성
$this->sourceDir = $sourceDir
$this->targetDir = $targetDir; ;
$ this->bcompiler = $bcompiler;
//소스 데이터가 존재하는지 확인
if(!is_dir($this->sourceDir)){
die('지정된 소스 폴더' .$ this->sourceDir.'존재하지 않습니다. 재설정하세요.')
} else {
//지정된 대상 폴더가 존재하는 경우 삭제하고 다시 시도하세요
if(is_dir( $this - >targetDir)){
echo '[대상 폴더 초기화]'.$this->newline.$this->newline
$this->cleanDir($this-> targetDir ,true);
}
//소스 폴더와 동일한 구조로 대상 폴더를 생성합니다
mkdir($this->targetDir,0777)
$dir_paths = $this- > getPaths($this->sourceDir,'*',GLOB_ONLYDIR)
foreach($dir_paths as $key => $path){
$path =explore('/',$path);
$path[0] = $this->targetDir;
echo '=> '.join('/',$path).$this->newline(join( ' /',$path),0777);
}
//소스 폴더의 파일 경로 목록 가져오기
$this->sourcefilePaths = $this->getPaths($this-> ; sourceDir ,'*');
//해당 대상의 파일 경로 목록을 일치시킵니다.
foreach($this->sourcefilePaths as $key => $path){
// 대상 폴더 파일 경로
$path =explore('/',$path)
$path[0] = $this->targetDir;
$this->targetPaths[$key] = Join( '/',$path);
}
//실행 전 폴더 크기 기록
$this->sizeBeforeZip = $this->getSizeUnit($this->getDirSize($ this ->sourceDir),2)
echo $this->newline.$this->newline
}
}
/**
* 압축 및 암호화 수행
* @return boolean
*/
public function zip(){
$this->newline = '';
echo '[암호화 프로세스 시작] (폴더 크기: '.$this->sizeBeforeZip.')'.$this- > ;newline.$this->newline;
//소스 파일 압축
foreach($this->sourcefilePaths as $key => $path){
if(is_file($ path) ){
//파일 정보 가져오기
$pathInfo = pathInfo($path)
echo '소스 파일 읽기:'.$path.$this->newline
/ /Get the 압축된 콘텐츠
echo '=>빈 주석 제거.....'
if($this->strip && $pathInfo['extension'] == 'php'){
$ fileAterZip = php_strip_whitespace($path);
} else {
$fileAterZip = file_get_contents($path);
}
echo 'Finished'.$this- >newline; 압축된 내용을 가져와서 대상 위치에 씁니다
$fp = fopen($this->targetPaths[$key],'w ')
echo '=> ';
fwrite($fp,$fileAterZip);
fclose($fp)
echo 'Complete'.$this->//암호화 여부
if($this->bcompiler && $pathInfo['extension'] == 'php'){
echo '=>원본 파일을 암호화합니다. .........'; >//원본 파일 복사
$fh = fopen($this->targetPaths[$key].'encrypt.php', "w");
bcompiler_write_header($fh)
bcompiler_write_file ($fh, $this->targetPaths[$key]);
bcompiler_write_footer($fh);
fclose($fh)
/ /암호화되지 않은 원본 파일 삭제
unlink($ this->targetPaths[$key])
//암호화된 파일 이름 바꾸기
rename($this->targetPaths[$key] .'encrypt.php',$this->targetPaths[$ key]);
echo 'Finished'.$this->newline
}
echo $this->newline.$ this->newline;
//압축 및 암호화된 폴더 크기 다시 계산
$this->sizeAfterZip = $this->getSizeUnit($this->getDirSize($this->targetDir),2); echo '[암호화 프로세스 종료]'.$this->newline.$this->newline
echo '"보고서 정보"'.$this->newline
echo '소스 정보 폴더: '.$this->sourceDir.'('.$this->sizeBeforeZip.')'.$this->newline
echo '대상 폴더:'.$this->targetDir .'( '.$this->sizeAfterZip.')'.$this->newline;
echo '파일 크기 증가: '.$this->getSizeUnit(($this->getDirSize($ this-> ;targetDir) - $this->getDirSize($this->sourceDir))).$this->newline
echo '총 파일 수:'.count($this->sourcefilePaths) . 'piece'.$this->newline
}
/**
* 해당 디렉터리의 모든 파일 삭제
*
* @param string $dir 삭제할 폴더
* @param boolean $deleteSelf 폴더 동시 삭제
* @return 무효
*/
비공개 함수 cleanDir($dir='.',$deleteSelf=true){
if (!$dh = @opendir($dir)) return;
while (($obj = readdir($dh))) {
if($obj=='.' || $obj== ' ..') 계속;
if (!@unlink($dir.'/'.$obj)) $this->cleanDir($dir.'/'.$obj, true)
}
if ($deleteSelf){
closedir($dh);
@rmdir($dir)
}
}
/**
* 폴더의 전체 파일 크기 가져오기
*
* @param string $dir 분석할 폴더
* @return int byte
*/
private function getDirSize($dir='.'){
//파일 경로 목록 가져오기
$filePaths = $this->getPaths($dir,'*')
//카운터 초기화
$sizeCounter = 0;
foreach($filePaths as $key => $path){
$sizeCounter = $sizeCounter filesize($path)
}
return($sizeCounter) ;
}
/**
* 폴더의 일치하는 모든 경로 가져오기
*
* @param string $start_dir 분석할 폴더
* @return array 파일 경로 배열
*/
비공개 함수 getPaths($sDir, $sPattern, $nFlags = NULL){
$sDir = escapeshellcmd($sDir); $aFiles = glob("$sDir/$sPattern", $nFlags);
foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) {
$aSubFiles = $this-> ($sSubDir, $sPattern, $nFlags);
$aFiles = array_merge($aFiles, $aSubFiles);
}
return $aFiles; */
공용 함수 getSizeUnit($size,$decimal=2,$split=false){
//단위 순서 설정
$unit = array('Bytes','KB',' MB ','GB','TB','PB','EB','ZB','YB')
//인덱스 초기화
$flag = 0
//나눗셈 단순화
while($size >= 1024){
$size = $size / 1024;
$flag;
}
//단위에서 값을 분리할지 여부
if ($split){
$sizeUnit = 배열(
'size' => number_format($size,$decimal),
'unit' => $unit[$flag]
) ;
} else {
$sizeUnit = (number_format($size,$decimal)).$unit[$flag]
}
//크기 및 단위 반환
return ( $ 크기 단위)
}
}
위 내용은 create Compatibledc의 내용을 포함하여 bcompiler를 사용하여 PHP 파일을 암호화하기 위한 create Compatibledc용 코드를 소개하고 있습니다. PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되길 바랍니다.

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Laravel은 직관적 인 플래시 방법을 사용하여 임시 세션 데이터 처리를 단순화합니다. 응용 프로그램에 간단한 메시지, 경고 또는 알림을 표시하는 데 적합합니다. 데이터는 기본적으로 후속 요청에만 지속됩니다. $ 요청-

PHP 클라이언트 URL (CURL) 확장자는 개발자를위한 강력한 도구이며 원격 서버 및 REST API와의 원활한 상호 작용을 가능하게합니다. PHP CURL은 존경받는 다중 프로모토콜 파일 전송 라이브러리 인 Libcurl을 활용하여 효율적인 execu를 용이하게합니다.

Alipay PHP ...

Laravel은 간결한 HTTP 응답 시뮬레이션 구문을 제공하여 HTTP 상호 작용 테스트를 단순화합니다. 이 접근법은 테스트 시뮬레이션을보다 직관적으로 만들면서 코드 중복성을 크게 줄입니다. 기본 구현은 다양한 응답 유형 단축키를 제공합니다. Illuminate \ support \ Facades \ http를 사용하십시오. http :: 가짜 ([ 'google.com'=> 'Hello World', 'github.com'=> [ 'foo'=> 'bar'], 'forge.laravel.com'=>

고객의 가장 긴급한 문제에 실시간 인스턴트 솔루션을 제공하고 싶습니까? 라이브 채팅을 통해 고객과 실시간 대화를 나누고 문제를 즉시 해결할 수 있습니다. 그것은 당신이 당신의 관습에 더 빠른 서비스를 제공 할 수 있도록합니다.

기사는 PHP 5.3에 도입 된 PHP의 LSB (Late STATIC BING)에 대해 논의하여 정적 방법의 런타임 해상도가보다 유연한 상속을 요구할 수있게한다. LSB의 실제 응용 프로그램 및 잠재적 성능

기사는 입력 유효성 검사, 인증 및 정기 업데이트를 포함한 취약점을 방지하기 위해 프레임 워크의 필수 보안 기능을 논의합니다.

이 기사에서는 프레임 워크에 사용자 정의 기능 추가, 아키텍처 이해, 확장 지점 식별 및 통합 및 디버깅을위한 모범 사례에 중점을 둡니다.
