라이브러리

[PHP] XSLTProcessor::getSecurityPrefs - 보안 기본 설정 가져오기


PHP 에서 XSLTProcessor::getSecurityPrefs 메서드는 XSLTProcessor 객체의 보안 설정을 반환합니다. 이 메서드는 XSLT 1.0 사양에 따라 XSLT 트랜스폼을 처리하는 동안 사용되는 보안 설정을 제공합니다.

XSLTProcessor::getSecurityPrefs 메서드의 사용


XSLTProcessor::getSecurityPrefs 메서드는 다음의 보안 설정을 반환합니다:

- `allowXsltExtensions`: XSLT 확장 함수를 사용할 수 있는지 여부
- `allowXsltScript`: XSLT 스크립트를 사용할 수 있는지 여부
- `allowXsltStylesheetImport`: XSLT 스타일 시트를 임포트할 수 있는지 여부
- `allowXsltStylesheetInclude`: XSLT 스타일 시트를 포함할 수 있는지 여부
- `allowXsltStylesheetExternalEntities`: XSLT 스타일 시트에서 외부 엔티티를 사용할 수 있는지 여부

예제


다음 예제는 XSLTProcessor::getSecurityPrefs 메서드를 사용하여 보안 설정을 반환하는 방법을 보여줍니다.

#hostingforum.kr
php

<?php



// XSLTProcessor 객체 생성

$xsltProcessor = new XSLTProcessor();



// 보안 설정 반환

$securityPrefs = $xsltProcessor->getSecurityPrefs();



// 보안 설정 출력

echo "allowXsltExtensions: " . ($securityPrefs['allowXsltExtensions'] ? 'true' : 'false') . "
";

echo "allowXsltScript: " . ($securityPrefs['allowXsltScript'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetImport: " . ($securityPrefs['allowXsltStylesheetImport'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetInclude: " . ($securityPrefs['allowXsltStylesheetInclude'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetExternalEntities: " . ($securityPrefs['allowXsltStylesheetExternalEntities'] ? 'true' : 'false') . "
";



?>



보안 설정 수정


XSLTProcessor::setSecurityPrefs 메서드를 사용하여 보안 설정을 수정할 수 있습니다.

#hostingforum.kr
php

<?php



// XSLTProcessor 객체 생성

$xsltProcessor = new XSLTProcessor();



// 보안 설정 수정

$xsltProcessor->setSecurityPrefs(array(

    'allowXsltExtensions' => true,

    'allowXsltScript' => false,

    'allowXsltStylesheetImport' => true,

    'allowXsltStylesheetInclude' => false,

    'allowXsltStylesheetExternalEntities' => true

));



// 보안 설정 반환

$securityPrefs = $xsltProcessor->getSecurityPrefs();



// 보안 설정 출력

echo "allowXsltExtensions: " . ($securityPrefs['allowXsltExtensions'] ? 'true' : 'false') . "
";

echo "allowXsltScript: " . ($securityPrefs['allowXsltScript'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetImport: " . ($securityPrefs['allowXsltStylesheetImport'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetInclude: " . ($securityPrefs['allowXsltStylesheetInclude'] ? 'true' : 'false') . "
";

echo "allowXsltStylesheetExternalEntities: " . ($securityPrefs['allowXsltStylesheetExternalEntities'] ? 'true' : 'false') . "
";



?>



이 예제는 XSLTProcessor::setSecurityPrefs 메서드를 사용하여 보안 설정을 수정하는 방법을 보여줍니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 97 페이지

검색

게시물 검색