问题
I'd like to know if there is a way to use a PHP script in the typo3 v9 or a newer version. If possible, I'd prefer a way to call a function and not to embed the code in an HTML box.
Thanks a lot
回答1:
A short history:
in earlier days (TYPO3 prior to 4.2) there was a PHP content element. As of the possibility to insert bad code it was removed.
then there was a possibilty to include any file with PHP code by typoscript as a userfunc
.
That was restricted by TYPO3 6 as you now can only use methods of classes as userfunc
.
For usage in the front end you can build a plugin, so the editor can use a function
(with parameters) as desired. or include it by typoscript (userfunc
) where you need it. This can be easily done with an extension (as bandanh commented), so your code is deployable and can be included in any installation.
来源:https://stackoverflow.com/questions/60304125/how-can-i-use-a-php-script-in-typo3-v9