PHP会话cookie设置错误的路径或随机路径

I am setting a PHP session cookie in my application. On some requests to the page in question, the PHP session cookie path is \, but on other requests to the same page, it gets set to the path of the page \test\hello.

I need it to always be set to \.

Why would it randomly change? How to I force it to always be \?

Use session_set_cookie_params http://php.net/manual/en/function.session-set-cookie-params.php to change path to /