In the above circuit you show no value for the resistor. You don't show what the inverter is, but it should have a very high input impedance, for the following reason. Also, the diode is used in the reverse biased mode, so the current will be very low, microamps if that.
With the three lead device, it would seem that it's a phototransistor. If so, then the third or base lead doesn't need to be connected. But if it's a phototransistor, then you shouldn't use it like the diode above, reverse biased.
Start with a transistor. If the base is connected to the collector, it is still technically and pracitcally an active device, with the base current controlling the collector current. Take one step backwards, close your eyes to that. Shine a light on a silicon PN junction and notice that an electrical voltage is produced if open circuit (or hi Z load) and that an electrical current is produced if shorted circuit (or low Z load). Partly open eyes, take one-half step forward. Shine a light on a transistor die (that is how the vast majority of phototransistors were made; a lens that focused the light on a 2N2222 or equivalent die). In effect, charge is being injected in the base. You now may open the eyes all the way and finish stepping forward.
There are a few things that have not yet been mentioned.
Most phototransistors are junction transistor, not field effect transistors.
This means that they operate on current flow not voltage levels as are common with FETs.
The rise and fall times of junction phototransistors are determined by the rate of change of the current through the base-emitter junction.
The collector current of phototransistors is usually very low, in the range of 400 to 800 microamps with full illumination. Darlington phototransistors can switch more collector current but rise and fall times increase from a few microseconds to several milliseconds.
The larger the area of the base is the more sensitive the phototransistors is. A lager base area means a large base-emitter capacitance. This sets up two competing goals. Where one would like fast turn on and off times the emitter impedance should be low, but to get a large output voltage swing with only 400 microamps of collector current the emitter impedance needs to be quite large.
One way to manage all these thing is to use a three terminal phototransistor and establish the base impedance independent of the emitter circuit.
Keeping the voltage drop across the phototransistor (Vce) low can also improve rise and fall times and sensitivity to light.
The 4N35 is an optocoupler not just a phototransistor.
for data sheet.
You may want to note that while the current transfer ratio for the 4N35 is specified to be 100% at 25C it drops to 40% at the high and low temperature extremes.
The CTR performance of related devices (4N25-4N28) is so poor (10-20%) that they have no specification for temperature extremes at all.
Optocouplers tend to have the optical design optimized for best performance.
When using phototransistors on the other hand the optical path does not lend itself to convent optimizations.
Manufactures of phototransistors seem to try very hard to obscure the specification for photon sensitivity of their products. This makes it quite difficult for a designer to compare products from various vendors.