Everyone's system is different, but if you like spinach, eat a bunch and it may well help.
It doesn't matter if it's raw or cooked.
Apples can help, too.
This is based on - well, things are moving a little too well through my system right now, and I'm trying to slow it down so I don't drop any more weight. I tend to eat a lot of spinach because I love the flavor, and it's packed with vitamins. I didn't eat any for a couple of days and, things stopped moving through my system quite so enthusiastically. I read where apples are good for helping with constipation, and I eat a lot of those, too, so I cut those out. That also helped a little.