XML Helper
The XML Helper file contains functions that assist in working with XMLdata.
Loading this Helper
This helper is loaded using the following code
- helper('xml');
Available Functions
The following functions are available:
Parameters:
- $str (string) – the text string to convert
- $protect_all (bool) – Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo;Returns:XML-converted stringReturn type:string
Takes a string as input and converts the following reserved XMLcharacters to entities:
- Ampersands: &
- Less than and greater than characters: < >
- Single and double quotes: ‘ “
- Dashes: -
This function ignores ampersands if they are part of existing numberedcharacter entities, e.g. {. Example:
- $string = '<p>Here is a paragraph & an entity ({).</p>';
- $string = xml_convert($string);
- echo $string;
outputs:
- <p>Here is a paragraph & an entity ({).</p>
当前内容版权归 codeigniter4 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 codeigniter4 .