What best practices should be followed when implementing Content Security Policy in PHP to maintain security and functionality of the website?

When implementing Content Security Policy in PHP, it is important to follow best practices to maintain both security and functionality of the website. This includes specifying trusted sources for content such as scripts, stylesheets, images, fonts, and plugins to prevent unauthorized code execution and data theft. Additionally, it is recommended to use the 'Content-Security-Policy' header to define the policy directives and ensure that the website adheres to them.

<?php
header("Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted-scripts.com; style-src 'self' https://trusted-styles.com; img-src 'self' https://trusted-images.com; font-src 'self' https://trusted-fonts.com; plugin-types application/pdf");
?>