PHP – Unexpected character in input: ” (ASCII=20) state=0

In your code, you’re doing this:

$template_file_name = require_once ( get_template_directory() . '/template.docx' );

…but that’s not how require_once (or require) works. require_once will load the file (or throw a warning if the file can’t be included, eg, bad permissions or the file doesn’t exist), but it will not return the filename; it will, instead, load the file and execute any PHP it finds therein.

A .docx file will not contain executable PHP code (if it does, you’ve got other problems).

In your case, the .docx file contains an ASCII 20 character, which is DC4, Device Control 4. This is not expected in a PHP context, so PHP is throwing an error or a warning.

Instead of require_once, you might be looking for fopen() or some of PHP’s other filesystem functions.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)