有没有一种快速的方法将会话名称附加到所有链接?

Is there a fast and efficient way to append a ?sid=asdasdasd or a &sid=asdasdasd to all urls on a page using PHP? Should I use output buffering for this?

I'm trying to have something like:

<a href="/something.php">hello</a>

to change to:

<a href="/something.php?sid=somethingrandom">hello</a>

In your PHP configuration, turn off session cookies, and turn on transparent sid support, which will automatically rewrite links to include a session ID.

Note that URL-based sessions are considered a bad practice.