The Moodle URL out_as_local_url function is used to convert an external URL to a local URL within the Moodle site. This function is useful for security reasons, as it ensures that all links within the Moodle site are pointing to local resources rather than external ones.
In this example, the out_as_local_url function is used to convert an external URL (https://www.example.com) to a local URL within the Moodle site. The resulting local URL is then echoed to the screen.
In this example, the second parameter of the out_as_local_url function is set to true. This ensures that even if the external URL is an HTTPS URL, it will still be converted to a local HTTP URL within the Moodle site. The resulting local URL is then echoed to the screen.
Package library: Moodle Core.
PHP moodle_url::out_as_local_url - 15 examples found. These are the top rated real world PHP examples of moodle_url::out_as_local_url extracted from open source projects. You can rate examples to help us improve the quality of examples.