如何将带有散列文件名的已编译CSS / JS包含到网页中

If you compile/merge the CSS/JS files into one with a compiler (e.g. webpack, grunt), the name of the file is hashed (e.g. df48gf8d789ds9fs.css).

Is there some kind of convention of including these files into the website?

I mean, as per usual, you would do

<link rel="stylesheet" href="style.css" />

However, if I have a hashed file name, I can not hard-code it like above.

How shall one do it e.g. in PHP?

My idea is like so, but I just do not know, there has to be a better solution.

<link rel="stylesheet" href="<?php echo get_dir_files_and_find_one_css(); ?>" />

EDIT: Yes, I would like to have hashed file name, to prevent a browser from caching the file.

Yeah, the hash is used for updating old caches that the browser may have and a way to use the file could be to just inject the filename into the HTML when building your project through a script of some sorts. However, specifying a filename when using the compiler doesn't cause this problem.